/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'cn-beijing' = 'pai.cn-beijing.aliyuncs.com',
    'cn-hangzhou' = 'pai.cn-hangzhou.aliyuncs.com',
    'cn-shanghai' = 'pai.cn-shanghai.aliyuncs.com',
    'cn-shenzhen' = 'pai.cn-shenzhen.aliyuncs.com',
    'cn-hongkong' = 'pai.cn-hongkong.aliyuncs.com',
    'ap-southeast-1' = 'pai.ap-southeast-1.aliyuncs.com',
    'ap-southeast-2' = 'pai.ap-southeast-2.aliyuncs.com',
    'ap-southeast-3' = 'pai.ap-southeast-3.aliyuncs.com',
    'ap-southeast-5' = 'pai.ap-southeast-5.aliyuncs.com',
    'us-west-1' = 'pai.us-west-1.aliyuncs.com',
    'us-east-1' = 'pai.us-east-1.aliyuncs.com',
    'eu-central-1' = 'pai.eu-central-1.aliyuncs.com',
    'me-east-1' = 'pai.me-east-1.aliyuncs.com',
    'ap-south-1' = 'pai.ap-south-1.aliyuncs.com',
    'cn-qingdao' = 'pai.cn-qingdao.aliyuncs.com',
    'cn-zhangjiakou' = 'pai.cn-zhangjiakou.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('paistudio', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ACS {
  ACSQuotaId?: string(name='ACSQuotaId'),
  associatedProducts?: [ string ](name='AssociatedProducts'),
}

model Action {
  actionType?: string(name='ActionType'),
}

model AlgorithmSpec {
  codeDir?: Location(name='CodeDir'),
  command?: [ string ](name='Command', description='This parameter is required.'),
  computeResource?: {
    policy?: {
      value?: string(name='Value', description='This parameter is required.'),
      version?: string(name='Version', description='This parameter is required.'),
    }(name='Policy', description='This parameter is required.'),
  }(name='ComputeResource'),
  customization?: {
    codeDir?: boolean(name='CodeDir'),
  }(name='Customization'),
  hyperParameters?: [
    HyperParameterDefinition
  ](name='HyperParameters'),
  image?: string(name='Image', description='This parameter is required.'),
  inputChannels?: [
    Channel
  ](name='InputChannels'),
  jobType?: string(name='JobType', description='This parameter is required.'),
  metricDefinitions?: [
    MetricDefinition
  ](name='MetricDefinitions'),
  outputChannels?: [
    Channel
  ](name='OutputChannels'),
  progressDefinitions?: {
    overallProgress?: {
      description?: string(name='Description'),
      regex?: string(name='Regex'),
    }(name='OverallProgress'),
    remainingTime?: {
      description?: string(name='Description'),
      regex?: string(name='Regex'),
    }(name='RemainingTime'),
  }(name='ProgressDefinitions'),
  resourceRequirements?: [
    ConditionExpression
  ](name='ResourceRequirements'),
  supportedInstanceTypes?: [ string ](name='SupportedInstanceTypes'),
  supportsDistributedTraining?: boolean(name='SupportsDistributedTraining'),
}

model AllocateStrategySpec {
  nodeSpecs?: [
    NodeSpec
  ](name='NodeSpecs'),
}

model BindingPolicy {
  excludeNodes?: [ string ](name='ExcludeNodes'),
  includeNodes?: [ string ](name='IncludeNodes'),
  nodeSpecCount?: long(name='NodeSpecCount', example='5'),
}

model Channel {
  description?: string(name='Description'),
  name?: string(name='Name', description='This parameter is required.'),
  properties?: map[string]any(name='Properties'),
  required?: boolean(name='Required'),
  supportedChannelTypes?: [ string ](name='SupportedChannelTypes'),
}

model ChannelProperty {
  name?: string(name='Name', description='This parameter is required.', example='SKlearn'),
  value?: string(name='Value', description='This parameter is required.', example='Framework'),
}

model ComponentSpec {
  codeDir?: Location(name='CodeDir'),
  command?: string(name='Command', description='This parameter is required.'),
  hyperParameters?: [
    HyperParameterDefinition
  ](name='HyperParameters'),
  image?: string(name='Image', description='This parameter is required.'),
  inputChannels?: [
    Channel
  ](name='InputChannels'),
  jobType?: string(name='JobType', description='This parameter is required.'),
  metricDefinitions?: [
    MetricDefinition
  ](name='MetricDefinitions'),
  outputChannels?: [
    Channel
  ](name='OutputChannels'),
  resourceRequirements?: [
    ConditionExpression
  ](name='ResourceRequirements'),
}

model ConditionExpression {
  key?: string(name='Key', description='This parameter is required.', example='SupportedMachineTypes'),
  operator?: string(name='Operator', description='This parameter is required.', example='in'),
  values?: [ string ](name='Values', description='This parameter is required.'),
}

model Features {
  quota?: {
    isEnabled?: boolean(name='IsEnabled', example='true'),
  }(name='Quota'),
}

model ForwardInfo {
  eipAllocationId?: string(name='EipAllocationId'),
  natGatewayId?: string(name='NatGatewayId'),
}

model GPUInfo {
  count?: long(name='count'),
  type?: string(name='type'),
}

model GPUMetric {
  index?: long(name='Index'),
  model?: string(name='Model'),
  status?: long(name='Status', example='0：异常；1：正常'),
  usageRate?: float(name='UsageRate'),
}

model HyperParameterDefinition {
  defaultValue?: string(name='DefaultValue'),
  description?: string(name='Description'),
  displayName?: string(name='DisplayName'),
  name?: string(name='Name', description='This parameter is required.'),
  range?: HyperParameterRange(name='Range'),
  required?: boolean(name='Required'),
  type?: string(name='Type', description='This parameter is required.'),
}

model HyperParameterRange {
  enum?: [ string ](name='Enum'),
  exclusiveMaximum?: boolean(name='ExclusiveMaximum'),
  exclusiveMinimum?: boolean(name='ExclusiveMinimum'),
  maxLength?: long(name='MaxLength'),
  maximum?: string(name='Maximum'),
  minLength?: long(name='MinLength'),
  minimum?: string(name='Minimum'),
  pattern?: string(name='Pattern'),
}

model JobSettings {
  advancedSettings?: map[string]any(name='AdvancedSettings'),
  businessUserId?: string(name='BusinessUserId', example='166924'),
  caller?: string(name='Caller', example='SilkFlow'),
  driver?: string(name='Driver', example='535.54.03'),
  enableErrorMonitoringInAIMaster?: boolean(name='EnableErrorMonitoringInAIMaster', example='false'),
  enableOssAppend?: boolean(name='EnableOssAppend', example='true'),
  enableRDMA?: boolean(name='EnableRDMA', example='true'),
  enableSanityCheck?: boolean(name='EnableSanityCheck', example='true'),
  enableTideResource?: boolean(name='EnableTideResource', example='true'),
  errorMonitoringArgs?: string(name='ErrorMonitoringArgs', example='--enable-log-hang-detection true'),
  jobReservedMinutes?: int32(name='JobReservedMinutes', example='30'),
  jobReservedPolicy?: string(name='JobReservedPolicy', example='Always'),
  oversoldType?: string(name='OversoldType', example='AcceptQuotaOverSold'),
  pipelineId?: string(name='PipelineId', example='pid-123456'),
  sanityCheckArgs?: string(name='SanityCheckArgs', example='--sanity-check-timing=AfterJobFaultTolerant --sanity-check-timeout-ops=MarkJobFai'),
  tags?: map[string]string(name='Tags'),
}

model JobViewMetric {
  CPUUsageRate?: string(name='CPUUsageRate'),
  diskReadRate?: string(name='DiskReadRate'),
  diskWriteRate?: string(name='DiskWriteRate'),
  GPUUsageRate?: string(name='GPUUsageRate'),
  jobId?: string(name='JobId'),
  jobType?: string(name='JobType'),
  memoryUsageRate?: string(name='MemoryUsageRate'),
  networkInputRate?: string(name='NetworkInputRate'),
  networkOutputRate?: string(name='NetworkOutputRate'),
  nodeNames?: [ string ](name='NodeNames'),
  requestCPU?: int32(name='RequestCPU'),
  requestGPU?: int32(name='RequestGPU'),
  requestMemory?: long(name='RequestMemory'),
  resourceGroupID?: string(name='ResourceGroupID', example='rg17tmvwiokhzaxg'),
  totalCPU?: int32(name='TotalCPU'),
  totalGPU?: int32(name='TotalGPU'),
  totalMemory?: long(name='TotalMemory'),
  userId?: string(name='UserId'),
}

model Label {
  key?: string(name='Key'),
  value?: string(name='Value'),
}

model Location {
  locationType?: string(name='LocationType'),
  locationValue?: map[string]any(name='LocationValue'),
}

model MachineGroup {
  creatorID?: string(name='CreatorID'),
  defaultDriver?: string(name='DefaultDriver', example='470.199.02'),
  ecsCount?: long(name='EcsCount'),
  ecsSpec?: string(name='EcsSpec'),
  gmtCreatedTime?: string(name='GmtCreatedTime'),
  gmtExpiredTime?: string(name='GmtExpiredTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  gmtStartedTime?: string(name='GmtStartedTime'),
  machineGroupID?: string(name='MachineGroupID', example='mg1'),
  orderInstanceId?: string(name='OrderInstanceId'),
  paymentDuration?: string(name='PaymentDuration'),
  paymentDurationUnit?: string(name='PaymentDurationUnit'),
  paymentType?: string(name='PaymentType'),
  reasonCode?: string(name='ReasonCode'),
  reasonMessage?: string(name='ReasonMessage'),
  resourceGroupID?: string(name='ResourceGroupID'),
  status?: string(name='Status'),
  supportedDrivers?: [ string ](name='SupportedDrivers'),
}

model Metric {
  time?: long(name='Time', example='rg17tmvwiokhzaxg'),
  value?: string(name='Value', example='23000'),
}

model MetricDefinition {
  description?: string(name='Description', example='train dataset oob score'),
  name?: string(name='Name', description='This parameter is required.', example='train:oob_score'),
  regex?: string(name='Regex', description='This parameter is required.', example='.*train:oob_score=([-+]?[0-9]*\\\\.?[0-9]+(?:[eE][-+]?[0-9]+)?).*'),
}

model Node {
  acceleratorType?: string(name='AcceleratorType'),
  boundQuotas?: [
    QuotaIdName
  ](name='BoundQuotas'),
  CPU?: string(name='CPU'),
  creatorId?: string(name='CreatorId'),
  GPU?: string(name='GPU'),
  GPUMemory?: string(name='GPUMemory'),
  GPUType?: string(name='GPUType'),
  gmtCreateTime?: string(name='GmtCreateTime'),
  gmtExpiredTime?: string(name='GmtExpiredTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  isBound?: boolean(name='IsBound'),
  limitCPU?: string(name='LimitCPU'),
  limitGPU?: string(name='LimitGPU'),
  limitMemory?: string(name='LimitMemory'),
  machineGroupId?: string(name='MachineGroupId'),
  memory?: string(name='Memory'),
  nodeName?: string(name='NodeName'),
  nodeStatus?: string(name='NodeStatus'),
  nodeType?: string(name='NodeType'),
  orderStatus?: string(name='OrderStatus'),
  podNum?: long(name='PodNum'),
  reasonCode?: string(name='ReasonCode'),
  reasonMessage?: string(name='ReasonMessage'),
  requestCPU?: string(name='RequestCPU'),
  requestGPU?: string(name='RequestGPU'),
  requestMemory?: string(name='RequestMemory'),
  resourceGroupId?: string(name='ResourceGroupId'),
  resourceGroupName?: string(name='ResourceGroupName'),
  users?: [
    UserInfo
  ](name='Users'),
  workloadNum?: long(name='WorkloadNum'),
}

model NodeGPUMetric {
  acceleratorType?: string(name='AcceleratorType'),
  GPUCount?: int32(name='GPUCount'),
  GPUMetrics?: [
    GPUMetric
  ](name='GPUMetrics'),
  GPUType?: string(name='GPUType'),
  memoryUtil?: float(name='MemoryUtil'),
  nodeId?: string(name='NodeId'),
  nodeType?: string(name='NodeType'),
  totalMemory?: float(name='TotalMemory'),
  usedMemory?: float(name='UsedMemory'),
}

model NodeMetric {
  GPUType?: string(name='GPUType'),
  metrics?: [
    Metric
  ](name='Metrics', example='23000'),
  nodeID?: string(name='NodeID', example='-i121212node'),
}

model NodeOperationResult {
  message?: string(name='Message'),
  nodeName?: string(name='NodeName'),
  status?: string(name='Status'),
}

model NodePodInfo {
  phase?: string(name='Phase', example='Running'),
  podIP?: string(name='PodIP', example='192.168.2.2'),
  podName?: string(name='PodName', example='test'),
  podNamespace?: string(name='PodNamespace', example='test'),
  resourceSpec?: ResourceAmount(name='ResourceSpec'),
  workloadId?: string(name='WorkloadId', example='dlc19de9s6vn3acr'),
  workloadType?: string(name='WorkloadType', example='dlc'),
}

model NodeSnapshot {
  ancestorQuotaWorkloadNum?: int32(name='AncestorQuotaWorkloadNum'),
  descendantQuotaWorkloadNum?: int32(name='DescendantQuotaWorkloadNum'),
  nodeName?: string(name='NodeName'),
  requestCPU?: string(name='RequestCPU'),
  requestGPU?: string(name='RequestGPU'),
  requestMemory?: string(name='RequestMemory'),
  selfQuotaWorkloadNum?: int32(name='SelfQuotaWorkloadNum'),
  workloadNum?: int32(name='WorkloadNum'),
  workloads?: [ 
    {
      name?: string(name='Name'),
      workloadId?: string(name='WorkloadId'),
      workloadType?: string(name='WorkloadType'),
    }
  ](name='Workloads'),
}

model NodeSpec {
  bindingPolicy?: BindingPolicy(name='BindingPolicy'),
  count?: long(name='Count', example='10'),
  type?: string(name='Type', example='ecs.g6.4xlarge'),
}

model NodeType {
  acceleratorType?: string(name='AcceleratorType', example='CPU'),
  CPU?: string(name='CPU', example='16'),
  GPU?: string(name='GPU', example='0'),
  GPUMemory?: string(name='GPUMemory', example='80G'),
  GPUType?: string(name='GPUType'),
  memory?: string(name='Memory', example='64Gi'),
  nodeType?: string(name='NodeType', example='ecs.g6.4xlarge'),
}

model NodeTypeStatistic {
  canBeBoundCount?: int32(name='CanBeBoundCount', example='4'),
  nodeType?: string(name='NodeType', example='ecs.g6.4xlarge'),
  totalCount?: int32(name='TotalCount', example='10'),
}

model NodeViewMetric {
  CPUUsageRate?: string(name='CPUUsageRate'),
  createdTime?: string(name='CreatedTime'),
  diskReadRate?: string(name='DiskReadRate'),
  diskWriteRate?: string(name='DiskWriteRate'),
  GPUType?: string(name='GPUType'),
  machineGroupID?: string(name='MachineGroupID'),
  memoryUsageRate?: string(name='MemoryUsageRate'),
  networkInputRate?: string(name='NetworkInputRate'),
  networkOutputRate?: string(name='NetworkOutputRate'),
  nodeID?: string(name='NodeID', example='-i121212node'),
  nodeStatus?: string(name='NodeStatus'),
  nodeType?: string(name='NodeType'),
  requestCPU?: long(name='RequestCPU'),
  requestGPU?: long(name='RequestGPU'),
  requestMemory?: long(name='RequestMemory'),
  taskIdMap?: map[string]any(name='TaskIdMap'),
  totalCPU?: long(name='TotalCPU'),
  totalGPU?: long(name='TotalGPU'),
  totalMemory?: long(name='TotalMemory'),
  totalTasks?: long(name='TotalTasks'),
  userIDs?: [ string ](name='UserIDs'),
  userNumber?: string(name='UserNumber'),
}

model Permission {
  isEnabled?: boolean(name='IsEnabled'),
  resourceType?: string(name='ResourceType'),
}

model QueueInfo {
  code?: string(name='Code', example='roleMaximumResource'),
  codeType?: string(name='CodeType', example='ConfigRule'),
  gmtCreatedTime?: string(name='GmtCreatedTime'),
  gmtDequeuedTime?: string(name='GmtDequeuedTime', example='"2023-06-22T00:00:00Z"'),
  gmtEnqueuedTime?: string(name='GmtEnqueuedTime', example='“2023-06-22T00:00:00Z”'),
  gmtPositionModifiedTime?: string(name='GmtPositionModifiedTime', example='"2023-06-22T00:00:00Z"'),
  name?: string(name='Name', example='test-label-79f5498dd-9qrzs'),
  position?: long(name='Position', example='10'),
  priority?: long(name='Priority', example='2'),
  queueStrategy?: string(name='QueueStrategy', example='PaiStrategyIntelligent'),
  quotaId?: string(name='QuotaId', example='“quotamtl37ge7gkvdz”'),
  reason?: string(name='Reason', example='Current GPU Limit is 5, limited by Role PAI.AlgoDeveloper'),
  resource?: ResourceAmount(name='Resource'),
  status?: string(name='Status', example='Enqueued'),
  userId?: string(name='UserId'),
  userName?: string(name='UserName'),
  workloadId?: string(name='WorkloadId', example='dlcxxxx'),
  workloadName?: string(name='WorkloadName'),
  workloadStatus?: string(name='WorkloadStatus', example='PreAllocation'),
  workloadType?: string(name='WorkloadType', example='dlc'),
  workspaceId?: string(name='WorkspaceId', example='“432524”'),
}

model Quota {
  allocateStrategy?: string(name='AllocateStrategy'),
  creatorId?: string(name='CreatorId'),
  description?: string(name='Description'),
  gmtCreatedTime?: string(name='GmtCreatedTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  labels?: [
    Label
  ](name='Labels'),
  latestOperationId?: string(name='LatestOperationId'),
  min?: ResourceSpec(name='Min'),
  parentQuotaId?: string(name='ParentQuotaId'),
  queueStrategy?: string(name='QueueStrategy'),
  quotaConfig?: QuotaConfig(name='QuotaConfig'),
  quotaDetails?: QuotaDetails(name='QuotaDetails'),
  quotaId?: string(name='QuotaId', example='quota12345'),
  quotaName?: string(name='QuotaName', example='dlc-quota'),
  reasonCode?: string(name='ReasonCode'),
  reasonMessage?: string(name='ReasonMessage'),
  resourceGroupIds?: [ string ](name='ResourceGroupIds'),
  resourceType?: string(name='ResourceType'),
  status?: string(name='Status'),
  subQuotas?: [
    QuotaIdName
  ](name='SubQuotas'),
  workspaces?: [
    WorkspaceIdName
  ](name='Workspaces'),
}

model QuotaConfig {
  ACS?: ACS(name='ACS'),
  clusterId?: string(name='ClusterId', example='ceeb37xxxx'),
  defaultGPUDriver?: string(name='DefaultGPUDriver', example='470.199.02'),
  enablePreemptSubquotaWorkloads?: boolean(name='EnablePreemptSubquotaWorkloads'),
  enableSubQuotaPreemption?: boolean(name='EnableSubQuotaPreemption'),
  resourceSpecs?: [
    WorkspaceSpecs
  ](name='ResourceSpecs'),
  subQuotaPreemptionConfig?: SubQuotaPreemptionConfig(name='SubQuotaPreemptionConfig'),
  supportGPUDrivers?: [ string ](name='SupportGPUDrivers'),
  supportRDMA?: boolean(name='SupportRDMA', example='false'),
  userVpc?: UserVpc(name='UserVpc'),
}

model QuotaDetails {
  actualMinQuota?: ResourceAmount(name='ActualMinQuota'),
  allocatedQuota?: ResourceAmount(name='AllocatedQuota'),
  ancestorsAllocatedQuota?: ResourceAmount(name='AncestorsAllocatedQuota'),
  descendantsAllocatedQuota?: ResourceAmount(name='DescendantsAllocatedQuota'),
  desiredMinQuota?: ResourceAmount(name='DesiredMinQuota'),
  requestedQuota?: ResourceAmount(name='RequestedQuota'),
  selfAllocatedQuota?: ResourceAmount(name='SelfAllocatedQuota'),
  usedQuota?: ResourceAmount(name='UsedQuota'),
}

model QuotaIdName {
  quotaId?: string(name='QuotaId', example='quota12345'),
  quotaName?: string(name='QuotaName', example='dlc-quota'),
}

model QuotaJob {
  queuing?: long(name='Queuing'),
  running?: long(name='Running'),
  total?: long(name='Total'),
}

model QuotaJobViewMetric {
  CPUUsageRate?: string(name='CPUUsageRate'),
  diskReadRate?: string(name='DiskReadRate'),
  diskWriteRate?: string(name='DiskWriteRate'),
  GPUUsageRate?: string(name='GPUUsageRate'),
  jobId?: string(name='JobId'),
  jobType?: string(name='JobType'),
  memoryUsageRate?: string(name='MemoryUsageRate'),
  networkInputRate?: string(name='NetworkInputRate'),
  networkOutputRate?: string(name='NetworkOutputRate'),
  nodeNames?: [ string ](name='NodeNames'),
  requestCPU?: int32(name='RequestCPU'),
  requestGPU?: int32(name='RequestGPU'),
  requestMemory?: long(name='RequestMemory'),
  totalCPU?: int32(name='TotalCPU'),
  totalGPU?: int32(name='TotalGPU'),
  totalMemory?: long(name='TotalMemory'),
  userId?: string(name='UserId'),
}

model QuotaMetric {
  GPUType?: string(name='GPUType'),
  metrics?: [
    Metric
  ](name='Metrics', example='23000'),
}

model QuotaNodeViewMetric {
  CPUUsageRate?: string(name='CPUUsageRate'),
  createdTime?: string(name='CreatedTime'),
  diskReadRate?: string(name='DiskReadRate'),
  diskWriteRate?: string(name='DiskWriteRate'),
  GPUType?: string(name='GPUType'),
  memoryUsageRate?: string(name='MemoryUsageRate'),
  networkInputRate?: string(name='NetworkInputRate'),
  networkOutputRate?: string(name='NetworkOutputRate'),
  nodeID?: string(name='NodeID', example='-i121212node'),
  nodeStatus?: string(name='NodeStatus'),
  nodeType?: string(name='NodeType'),
  quotaId?: string(name='QuotaId'),
  requestCPU?: long(name='RequestCPU'),
  requestGPU?: long(name='RequestGPU'),
  requestMemory?: long(name='RequestMemory'),
  taskIdMap?: map[string]any(name='TaskIdMap'),
  totalCPU?: long(name='TotalCPU'),
  totalGPU?: long(name='TotalGPU'),
  totalMemory?: long(name='TotalMemory'),
  totalTasks?: long(name='TotalTasks'),
  userIDs?: [ string ](name='UserIDs'),
  userNumber?: string(name='UserNumber'),
}

model QuotaTopo {
  depth?: string(name='Depth'),
  parentQuotaId?: string(name='ParentQuotaId'),
  quotaDetails?: QuotaDetails(name='QuotaDetails'),
  quotaId?: string(name='QuotaId'),
  quotaName?: string(name='QuotaName'),
  resourceType?: string(name='ResourceType'),
  workloadDetails?: WorkloadDetails(name='WorkloadDetails'),
}

model QuotaUser {
  resources?: {
    submitted?: ResourceAmount(name='Submitted'),
    used?: ResourceAmount(name='Used'),
  }(name='Resources'),
  userId?: string(name='UserId'),
  username?: string(name='Username'),
  workloadCount?: int32(name='WorkloadCount'),
}

model QuotaUserViewMetric {
  CPUNodeNumber?: int32(name='CPUNodeNumber'),
  CPUUsageRate?: string(name='CPUUsageRate'),
  cpuJobNames?: [ string ](name='CpuJobNames'),
  cpuNodeNames?: [ string ](name='CpuNodeNames'),
  diskReadRate?: string(name='DiskReadRate'),
  diskWriteRate?: string(name='DiskWriteRate'),
  GPUNodeNumber?: int32(name='GPUNodeNumber'),
  GPUUsageRate?: string(name='GPUUsageRate'),
  gpuJobNames?: [ string ](name='GpuJobNames'),
  gpuNodeNames?: [ string ](name='GpuNodeNames'),
  jobType?: string(name='JobType'),
  memoryUsageRate?: string(name='MemoryUsageRate'),
  networkInputRate?: string(name='NetworkInputRate'),
  networkOutputRate?: string(name='NetworkOutputRate'),
  nodeNames?: [ string ](name='NodeNames'),
  requestCPU?: int32(name='RequestCPU'),
  requestGPU?: int32(name='RequestGPU'),
  requestMemory?: long(name='RequestMemory'),
  totalCPU?: int32(name='TotalCPU'),
  totalGPU?: int32(name='TotalGPU'),
  totalMemory?: long(name='TotalMemory'),
  userId?: string(name='UserId'),
}

model ResourceAmount {
  CPU?: string(name='CPU', example='100'),
  GPU?: string(name='GPU', example='16'),
  GPUType?: string(name='GPUType', example='GPU'),
  memory?: string(name='Memory', example='100Gi'),
}

model ResourceDiagnosisDetail {
  exceedResources?: [ string ](name='ExceedResources'),
  limit?: ResourceAmount(name='Limit'),
  status?: string(name='Status'),
  used?: ResourceAmount(name='Used'),
  workloadIds?: [ string ](name='WorkloadIds'),
}

model ResourceGroup {
  creatorID?: string(name='CreatorID'),
  gmtCreatedTime?: string(name='GmtCreatedTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  name?: string(name='Name', example='RG1'),
  nodeCount?: int32(name='NodeCount'),
  resourceGroupID?: string(name='ResourceGroupID', example='rg17tmvwiokhzaxg'),
  userVpc?: UserVpc(name='UserVpc'),
  workspaceID?: string(name='WorkspaceID', example='23000'),
}

model ResourceGroupMetric {
  gpuType?: string(name='GpuType'),
  metrics?: [
    Metric
  ](name='Metrics', example='23000'),
  resourceGroupID?: string(name='ResourceGroupID', example='rg17tmvwiokhzaxg'),
}

model ResourceLimitDetails {
  GCLevel?: string(name='GCLevel'),
  resourceLimit?: map[string]any(name='ResourceLimit'),
  shouldIgnoreResourceCheck?: boolean(name='ShouldIgnoreResourceCheck'),
}

model ResourceOperation {
  creatorId?: string(name='CreatorId'),
  gmtCreatedTime?: string(name='GmtCreatedTime'),
  gmtEndTime?: string(name='GmtEndTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  gmtStartTime?: string(name='GmtStartTime'),
  objectId?: string(name='ObjectId'),
  objectType?: string(name='ObjectType'),
  operationDescription?: string(name='OperationDescription'),
  operationId?: string(name='OperationId'),
  operationSpecJson?: string(name='OperationSpecJson'),
  operationType?: string(name='OperationType'),
  reasonCode?: string(name='ReasonCode'),
  reasonMessage?: string(name='ReasonMessage'),
  status?: string(name='Status'),
}

model ResourceSpec {
  nodeSpecs?: [
    NodeSpec
  ](name='NodeSpecs'),
}

model Rules {
  scheduling?: SchedulingRule(name='Scheduling'),
}

model SchedulingRule {
  cronTab?: string(name='CronTab', nullable=true),
  endAt?: string(name='EndAt', nullable=true),
  executeOnce?: boolean(name='ExecuteOnce', nullable=true),
  startAt?: string(name='StartAt', nullable=true),
}

model SpotPriceItem {
  instanceType?: string(name='InstanceType', example='ml.gu8xf.8xlarge-gu108'),
  spotDiscount?: float(name='SpotDiscount', example='0.1'),
  timestamp?: string(name='Timestamp', example='2024-01-17T06:00:00Z'),
  zoneId?: string(name='ZoneId', example='cn-wulanchabu-a'),
}

model SpotStockPreview {
  instanceType?: string(name='InstanceType', example='ml.gu8xf.8xlarge-gu108'),
  spotDiscount?: float(name='SpotDiscount', example='0.1'),
  stockStatus?: string(name='StockStatus', example='WithStock'),
}

model SubQuotaPreemptionConfig {
  preemptedPriorityUpperBound?: long(name='PreemptedPriorityUpperBound', example='9'),
  preemptedProducts?: [ string ](name='PreemptedProducts'),
}

model Task {
  actions?: [
    Action
  ](name='Actions'),
  description?: string(name='Description'),
  gmtActivatedTime?: string(name='GmtActivatedTime'),
  gmtCreatedTime?: string(name='GmtCreatedTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  gmtStoppedTime?: string(name='GmtStoppedTime'),
  quotaId?: string(name='QuotaId'),
  rules?: Rules(name='Rules'),
  status?: string(name='Status'),
  taskId?: string(name='TaskId'),
  taskName?: string(name='TaskName'),
  userId?: string(name='UserId'),
  userName?: string(name='UserName'),
}

model TaskInstance {
  gmtCreatedTime?: string(name='GmtCreatedTime'),
  gmtEndTime?: string(name='GmtEndTime'),
  status?: string(name='Status'),
  taskId?: string(name='TaskId'),
  taskInstanceId?: string(name='TaskInstanceId'),
  tenantId?: string(name='TenantId'),
  userId?: string(name='UserId'),
}

model TaskInstanceEvent {
  gmtEndTime?: string(name='GmtEndTime'),
  gmtStartTime?: string(name='GmtStartTime'),
  message?: string(name='Message'),
  podName?: string(name='PodName'),
  status?: string(name='Status'),
  workloadType?: string(name='WorkloadType'),
}

model TimeRangeFilter {
  endTime?: string(name='EndTime', example='2023-06-22T00:00:00Z'),
  startTime?: string(name='StartTime', example='2023-06-22T00:00:00Z'),
}

model UnschedulableNodeDetail {
  nodes?: [ string ](name='Nodes'),
  reason?: string(name='Reason'),
}

model UserInfo {
  userId?: string(name='UserId'),
  userName?: string(name='UserName'),
}

model UserQuotaPermission {
  permissions?: [ string ](name='Permissions'),
  quotaId?: string(name='QuotaId'),
}

model UserViewMetric {
  CPUNodeNumber?: int32(name='CPUNodeNumber'),
  CPUUsageRate?: string(name='CPUUsageRate'),
  cpuJobNames?: [ string ](name='CpuJobNames'),
  cpuNodeNames?: [ string ](name='CpuNodeNames'),
  diskReadRate?: string(name='DiskReadRate'),
  diskWriteRate?: string(name='DiskWriteRate'),
  GPUNodeNumber?: int32(name='GPUNodeNumber'),
  GPUUsageRate?: string(name='GPUUsageRate'),
  gpuJobNames?: [ string ](name='GpuJobNames'),
  gpuNodeNames?: [ string ](name='GpuNodeNames'),
  jobType?: string(name='JobType'),
  memoryUsageRate?: string(name='MemoryUsageRate'),
  networkInputRate?: string(name='NetworkInputRate'),
  networkOutputRate?: string(name='NetworkOutputRate'),
  nodeNames?: [ string ](name='NodeNames'),
  requestCPU?: int32(name='RequestCPU'),
  requestGPU?: int32(name='RequestGPU'),
  requestMemory?: long(name='RequestMemory'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg17tmvwiokhzaxg'),
  totalCPU?: int32(name='TotalCPU'),
  totalGPU?: int32(name='TotalGPU'),
  totalMemory?: long(name='TotalMemory'),
  userId?: string(name='UserId'),
}

model UserVpc {
  defaultForwardInfo?: ForwardInfo(name='DefaultForwardInfo'),
  defaultRoute?: string(name='DefaultRoute'),
  extendedCIDRs?: [ string ](name='ExtendedCIDRs'),
  roleArn?: string(name='RoleArn'),
  securityGroupId?: string(name='SecurityGroupId'),
  switchId?: string(name='SwitchId'),
  vpcId?: string(name='VpcId'),
}

model WorkloadDetails {
  DLC?: QuotaJob(name='DLC'),
  DSW?: QuotaJob(name='DSW'),
  EAS?: QuotaJob(name='EAS'),
  summary?: QuotaJob(name='Summary'),
}

model WorkspaceIdName {
  workspaceId?: string(name='WorkspaceId', example='ws123456'),
}

model WorkspaceSpec {
  code?: string(name='Code'),
  codeType?: string(name='CodeType'),
  isGuaranteedValid?: boolean(name='IsGuaranteedValid'),
  isOverSoldValid?: boolean(name='IsOverSoldValid'),
  reason?: string(name='Reason'),
  spec?: ResourceAmount(name='Spec'),
  specName?: string(name='SpecName'),
}

model WorkspaceSpecs {
  product?: string(name='Product'),
  specs?: [
    WorkspaceSpec
  ](name='Specs'),
  workspaceId?: string(name='WorkspaceId'),
}

model CheckInstanceWebTerminalRequest {
  checkInfo?: string(name='CheckInfo', example='wss://pai-dlc-proxy-cn-shanghai.aliyun.com/terminal/t1157703270994901/dlcmjzjt1dxbmx4h/dlcmjzjt1dxbmx4h-worker-0?Token=******'),
}

model CheckInstanceWebTerminalResponseBody = {
  requestId?: string(name='RequestId', example='F2D0392B-D749-5C48-A98A-3FAE5C9444A6'),
}

model CheckInstanceWebTerminalResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckInstanceWebTerminalResponseBody(name='body'),
}

/**
 * @summary 检查WebTerminal
 *
 * @param request CheckInstanceWebTerminalRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckInstanceWebTerminalResponse
 */
async function checkInstanceWebTerminalWithOptions(TrainingJobId: string, InstanceId: string, request: CheckInstanceWebTerminalRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CheckInstanceWebTerminalResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.checkInfo)) {
    body['CheckInfo'] = request.checkInfo;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CheckInstanceWebTerminal',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/webterminals/action/check`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 检查WebTerminal
 *
 * @param request CheckInstanceWebTerminalRequest
 * @return CheckInstanceWebTerminalResponse
 */
async function checkInstanceWebTerminal(TrainingJobId: string, InstanceId: string, request: CheckInstanceWebTerminalRequest): CheckInstanceWebTerminalResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return checkInstanceWebTerminalWithOptions(TrainingJobId, InstanceId, request, headers, runtime);
}

model CreateAlgorithmRequest {
  algorithmDescription?: string(name='AlgorithmDescription'),
  algorithmName?: string(name='AlgorithmName', example='llm_training'),
  displayName?: string(name='DisplayName'),
  workspaceId?: string(name='WorkspaceId', example='12345'),
}

model CreateAlgorithmResponseBody = {
  algorithmId?: string(name='AlgorithmId', example='algo-xsldfvu1334'),
  requestId?: string(name='RequestId', example='E7C42CC7-2E85-508A-84F4-923B605FD10F'),
}

model CreateAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAlgorithmResponseBody(name='body'),
}

/**
 * @summary 创建新的算法
 *
 * @param request CreateAlgorithmRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAlgorithmResponse
 */
async function createAlgorithmWithOptions(request: CreateAlgorithmRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateAlgorithmResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithmDescription)) {
    body['AlgorithmDescription'] = request.algorithmDescription;
  }
  if (!Util.isUnset(request.algorithmName)) {
    body['AlgorithmName'] = request.algorithmName;
  }
  if (!Util.isUnset(request.displayName)) {
    body['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAlgorithm',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建新的算法
 *
 * @param request CreateAlgorithmRequest
 * @return CreateAlgorithmResponse
 */
async function createAlgorithm(request: CreateAlgorithmRequest): CreateAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createAlgorithmWithOptions(request, headers, runtime);
}

model CreateAlgorithmVersionRequest {
  algorithmSpec?: AlgorithmSpec(name='AlgorithmSpec'),
}

model CreateAlgorithmVersionShrinkRequest {
  algorithmSpecShrink?: string(name='AlgorithmSpec'),
}

model CreateAlgorithmVersionResponseBody = {
  algorithmId?: string(name='AlgorithmId', example='algo-xsldfvu1334'),
  algorithmVersion?: string(name='AlgorithmVersion', example='v0.0.1'),
}

model CreateAlgorithmVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAlgorithmVersionResponseBody(name='body'),
}

/**
 * @summary 创建一个新的算法版本
 *
 * @param tmpReq CreateAlgorithmVersionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAlgorithmVersionResponse
 */
async function createAlgorithmVersionWithOptions(AlgorithmId: string, AlgorithmVersion: string, tmpReq: CreateAlgorithmVersionRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateAlgorithmVersionResponse {
  Util.validateModel(tmpReq);
  var request = new CreateAlgorithmVersionShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.algorithmSpec)) {
    request.algorithmSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.algorithmSpec, 'AlgorithmSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithmSpecShrink)) {
    body['AlgorithmSpec'] = request.algorithmSpecShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAlgorithmVersion',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}/versions/${OpenApiUtil.getEncodeParam(AlgorithmVersion)}`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建一个新的算法版本
 *
 * @param request CreateAlgorithmVersionRequest
 * @return CreateAlgorithmVersionResponse
 */
async function createAlgorithmVersion(AlgorithmId: string, AlgorithmVersion: string, request: CreateAlgorithmVersionRequest): CreateAlgorithmVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createAlgorithmVersionWithOptions(AlgorithmId, AlgorithmVersion, request, headers, runtime);
}

model CreateInstanceWebTerminalResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  webTerminalId?: string(name='WebTerminalId', example='wss://pai-dlc-proxy-cn-shanghai.aliyun.com/terminal/t1157703270994901/dlcmjzjt1dxbmx4h/dlcmjzjt1dxbmx4h-worker-0?Token=******'),
}

model CreateInstanceWebTerminalResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceWebTerminalResponseBody(name='body'),
}

/**
 * @summary 创建WebTerminal
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceWebTerminalResponse
 */
async function createInstanceWebTerminalWithOptions(TrainingJobId: string, InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceWebTerminalResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateInstanceWebTerminal',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/webterminals`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建WebTerminal
 *
 * @return CreateInstanceWebTerminalResponse
 */
async function createInstanceWebTerminal(TrainingJobId: string, InstanceId: string): CreateInstanceWebTerminalResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceWebTerminalWithOptions(TrainingJobId, InstanceId, headers, runtime);
}

model CreateQuotaRequest {
  allocateStrategy?: string(name='AllocateStrategy', example='ByNodeSpecs'),
  description?: string(name='Description', example='this is a test quota'),
  labels?: [
    Label
  ](name='Labels'),
  min?: ResourceSpec(name='Min'),
  parentQuotaId?: string(name='ParentQuotaId', example='quota1ci8g793pgm'),
  queueStrategy?: string(name='QueueStrategy', example='PaiStrategyIntelligent', nullable=true),
  quotaConfig?: QuotaConfig(name='QuotaConfig'),
  quotaName?: string(name='QuotaName', example='test-quota'),
  resourceGroupIds?: [ string ](name='ResourceGroupIds'),
  resourceType?: string(name='ResourceType', example='ECS'),
}

model CreateQuotaResponseBody = {
  quotaId?: string(name='QuotaId', description='Quota Id', example='quotad2kd8ljpsno'),
  requestId?: string(name='RequestId', example='CBF05F13-B24C-5129-9048-4FA684DCD579'),
}

model CreateQuotaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateQuotaResponseBody(name='body'),
}

/**
 * @summary 创建Quota
 *
 * @param request CreateQuotaRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateQuotaResponse
 */
async function createQuotaWithOptions(request: CreateQuotaRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateQuotaResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.allocateStrategy)) {
    body['AllocateStrategy'] = request.allocateStrategy;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.labels)) {
    body['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.min)) {
    body['Min'] = request.min;
  }
  if (!Util.isUnset(request.parentQuotaId)) {
    body['ParentQuotaId'] = request.parentQuotaId;
  }
  if (!Util.isUnset(request.queueStrategy)) {
    body['QueueStrategy'] = request.queueStrategy;
  }
  if (!Util.isUnset(request.quotaConfig)) {
    body['QuotaConfig'] = request.quotaConfig;
  }
  if (!Util.isUnset(request.quotaName)) {
    body['QuotaName'] = request.quotaName;
  }
  if (!Util.isUnset(request.resourceGroupIds)) {
    body['ResourceGroupIds'] = request.resourceGroupIds;
  }
  if (!Util.isUnset(request.resourceType)) {
    body['ResourceType'] = request.resourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateQuota',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/quotas`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建Quota
 *
 * @param request CreateQuotaRequest
 * @return CreateQuotaResponse
 */
async function createQuota(request: CreateQuotaRequest): CreateQuotaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createQuotaWithOptions(request, headers, runtime);
}

model CreateResourceGroupRequest {
  computingResourceProvider?: string(name='ComputingResourceProvider', example='Ecs'),
  description?: string(name='Description', example='test_api_report'),
  name?: string(name='Name', example='testResourceGroup'),
  resourceType?: string(name='ResourceType', example='Ecs'),
  tag?: [ 
    {
      key?: string(name='Key', example='TestKey'),
      value?: string(name='Value', example='TestValue'),
    }
  ](name='Tag'),
  userVpc?: UserVpc(name='UserVpc'),
}

model CreateResourceGroupResponseBody = {
  requestId?: string(name='RequestId', example='18D5A1C6-14B8-545E-8408-0A7DDB4C6B5E'),
  resourceGroupID?: string(name='ResourceGroupID', description='ResourceGroup ID。', example='rgf0zhfqn1d4ity2'),
}

model CreateResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateResourceGroupResponseBody(name='body'),
}

/**
 * @summary 创建资源组
 *
 * @param request CreateResourceGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateResourceGroupResponse
 */
async function createResourceGroupWithOptions(request: CreateResourceGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateResourceGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.computingResourceProvider)) {
    body['ComputingResourceProvider'] = request.computingResourceProvider;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.resourceType)) {
    body['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    body['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.userVpc)) {
    body['UserVpc'] = request.userVpc;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateResourceGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建资源组
 *
 * @param request CreateResourceGroupRequest
 * @return CreateResourceGroupResponse
 */
async function createResourceGroup(request: CreateResourceGroupRequest): CreateResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createResourceGroupWithOptions(request, headers, runtime);
}

model CreateTrainingJobRequest {
  algorithmName?: string(name='AlgorithmName', example='ev_classification'),
  algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
  algorithmSpec?: AlgorithmSpec(name='AlgorithmSpec'),
  algorithmVersion?: string(name='AlgorithmVersion', example='v1.0.0'),
  codeDir?: Location(name='CodeDir'),
  computeResource?: {
    ecsCount?: long(name='EcsCount', example='1'),
    ecsSpec?: string(name='EcsSpec', example='ecs.gn5-c8g1.2xlarge'),
    instanceCount?: long(name='InstanceCount', example='1'),
    instanceSpec?: {
      CPU?: string(name='CPU', example='8'),
      GPU?: string(name='GPU', example='1'),
      GPUType?: string(name='GPUType', example='V100'),
      memory?: string(name='Memory', example='32'),
      sharedMemory?: string(name='SharedMemory', example='32'),
    }(name='InstanceSpec'),
    resourceId?: string(name='ResourceId', example='quotam670lixikcs'),
    spotSpec?: {
      spotDiscountLimit?: float(name='SpotDiscountLimit', example='9'),
      spotStrategy?: string(name='SpotStrategy', example='SpotWithPriceLimit'),
    }(name='SpotSpec'),
    useSpotInstance?: boolean(name='UseSpotInstance', example='true'),
  }(name='ComputeResource'),
  environments?: map[string]string(name='Environments'),
  experimentConfig?: {
    experimentId?: string(name='ExperimentId', example='exp-ds9aefia90v'),
  }(name='ExperimentConfig'),
  hyperParameters?: [ 
    {
      name?: string(name='Name', example='learning_rate'),
      value?: string(name='Value', example='0.0001'),
    }
  ](name='HyperParameters'),
  inputChannels?: [ 
    {
      datasetId?: string(name='DatasetId', example='d-475megosidivjfgfq6'),
      inputUri?: string(name='InputUri', example='oss://pai-quickstart-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/modelscope/models/qwen2-0.5b/main/'),
      name?: string(name='Name', example='model'),
      options?: string(name='Options'),
      versionName?: string(name='VersionName'),
    }
  ](name='InputChannels'),
  labels?: [ 
    {
      key?: string(name='Key', example='CreatedBy'),
      value?: string(name='Value', example='QuickStart'),
    }
  ](name='Labels'),
  outputChannels?: [ 
    {
      datasetId?: string(name='DatasetId', example='d-475megosidivjfgfq6'),
      name?: string(name='Name', example='model'),
      outputUri?: string(name='OutputUri', example='oss://pai-quickstart-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/modelscope/models/qwen2-0.5b/main/'),
      versionName?: string(name='VersionName'),
    }
  ](name='OutputChannels'),
  priority?: int32(name='Priority'),
  pythonRequirements?: [ string ](name='PythonRequirements'),
  roleArn?: string(name='RoleArn', example='acs:ram::1157703270994901:role/aliyunserviceroleforpaiworkspace'),
  scheduler?: {
    maxRunningTimeInMinutes?: long(name='MaxRunningTimeInMinutes'),
    maxRunningTimeInSeconds?: long(name='MaxRunningTimeInSeconds', example='0'),
  }(name='Scheduler'),
  settings?: JobSettings(name='Settings'),
  trainingJobDescription?: string(name='TrainingJobDescription', example='qwen large language model training'),
  trainingJobName?: string(name='TrainingJobName', description='This parameter is required.', example='qwen_llm'),
  userVpc?: {
    defaultRoute?: string(name='DefaultRoute', example='eth0'),
    extendedCIDRs?: [ string ](name='ExtendedCIDRs'),
    securityGroupId?: string(name='SecurityGroupId', example='sg-qdfasd13sdasf'),
    switchId?: string(name='SwitchId', example='vs-icrc813vdsfol'),
    vpcId?: string(name='VpcId', description='VPC ID。', example='vpc-dxiflssjx978sl'),
  }(name='UserVpc'),
  workspaceId?: string(name='WorkspaceId', description='This parameter is required.', example='12345'),
}

model CreateTrainingJobResponseBody = {
  requestId?: string(name='RequestId', example='E7C42CC7-2E85-508A-84F4-923B605FD10F'),
  trainingJobId?: string(name='TrainingJobId', example='traineyfz0m2hsfv'),
}

model CreateTrainingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTrainingJobResponseBody(name='body'),
}

/**
 * @summary 创建TrainingJob
 *
 * @param request CreateTrainingJobRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTrainingJobResponse
 */
async function createTrainingJobWithOptions(request: CreateTrainingJobRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTrainingJobResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithmName)) {
    body['AlgorithmName'] = request.algorithmName;
  }
  if (!Util.isUnset(request.algorithmProvider)) {
    body['AlgorithmProvider'] = request.algorithmProvider;
  }
  if (!Util.isUnset(request.algorithmSpec)) {
    body['AlgorithmSpec'] = request.algorithmSpec;
  }
  if (!Util.isUnset(request.algorithmVersion)) {
    body['AlgorithmVersion'] = request.algorithmVersion;
  }
  if (!Util.isUnset(request.codeDir)) {
    body['CodeDir'] = request.codeDir;
  }
  if (!Util.isUnset(request.computeResource)) {
    body['ComputeResource'] = request.computeResource;
  }
  if (!Util.isUnset(request.environments)) {
    body['Environments'] = request.environments;
  }
  if (!Util.isUnset(request.experimentConfig)) {
    body['ExperimentConfig'] = request.experimentConfig;
  }
  if (!Util.isUnset(request.hyperParameters)) {
    body['HyperParameters'] = request.hyperParameters;
  }
  if (!Util.isUnset(request.inputChannels)) {
    body['InputChannels'] = request.inputChannels;
  }
  if (!Util.isUnset(request.labels)) {
    body['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.outputChannels)) {
    body['OutputChannels'] = request.outputChannels;
  }
  if (!Util.isUnset(request.priority)) {
    body['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.pythonRequirements)) {
    body['PythonRequirements'] = request.pythonRequirements;
  }
  if (!Util.isUnset(request.roleArn)) {
    body['RoleArn'] = request.roleArn;
  }
  if (!Util.isUnset(request.scheduler)) {
    body['Scheduler'] = request.scheduler;
  }
  if (!Util.isUnset(request.settings)) {
    body['Settings'] = request.settings;
  }
  if (!Util.isUnset(request.trainingJobDescription)) {
    body['TrainingJobDescription'] = request.trainingJobDescription;
  }
  if (!Util.isUnset(request.trainingJobName)) {
    body['TrainingJobName'] = request.trainingJobName;
  }
  if (!Util.isUnset(request.userVpc)) {
    body['UserVpc'] = request.userVpc;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTrainingJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建TrainingJob
 *
 * @param request CreateTrainingJobRequest
 * @return CreateTrainingJobResponse
 */
async function createTrainingJob(request: CreateTrainingJobRequest): CreateTrainingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTrainingJobWithOptions(request, headers, runtime);
}

model DeleteAlgorithmResponseBody = {
  requestId?: string(name='requestId', example='FFB1D4B4-B253-540A-9B3B-AA711C48A1B7'),
}

model DeleteAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAlgorithmResponseBody(name='body'),
}

/**
 * @summary 删除算法
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAlgorithmResponse
 */
async function deleteAlgorithmWithOptions(AlgorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteAlgorithmResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteAlgorithm',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除算法
 *
 * @return DeleteAlgorithmResponse
 */
async function deleteAlgorithm(AlgorithmId: string): DeleteAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteAlgorithmWithOptions(AlgorithmId, headers, runtime);
}

model DeleteAlgorithmVersionResponseBody = {
  requestId?: string(name='RequestId', example='F082BD0D-21E1-5F9B-81A0-AB07485B03CD'),
}

model DeleteAlgorithmVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAlgorithmVersionResponseBody(name='body'),
}

/**
 * @summary 删除算法版本
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAlgorithmVersionResponse
 */
async function deleteAlgorithmVersionWithOptions(AlgorithmId: string, AlgorithmVersion: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteAlgorithmVersionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteAlgorithmVersion',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}/versions/${OpenApiUtil.getEncodeParam(AlgorithmVersion)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除算法版本
 *
 * @return DeleteAlgorithmVersionResponse
 */
async function deleteAlgorithmVersion(AlgorithmId: string, AlgorithmVersion: string): DeleteAlgorithmVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteAlgorithmVersionWithOptions(AlgorithmId, AlgorithmVersion, headers, runtime);
}

model DeleteMachineGroupResponseBody = {
  machineGroupID?: string(name='MachineGroupID'),
  requestId?: string(name='RequestId'),
}

model DeleteMachineGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteMachineGroupResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI DeleteMachineGroup is deprecated
 *
 * @summary delete machine group
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteMachineGroupResponse
 */
// Deprecated
async function deleteMachineGroupWithOptions(MachineGroupID: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteMachineGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteMachineGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/machinegroups/${OpenApiUtil.getEncodeParam(MachineGroupID)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI DeleteMachineGroup is deprecated
 *
 * @summary delete machine group
 *
 * @return DeleteMachineGroupResponse
 */
// Deprecated
async function deleteMachineGroup(MachineGroupID: string): DeleteMachineGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteMachineGroupWithOptions(MachineGroupID, headers, runtime);
}

model DeleteQuotaResponseBody = {
  quotaId?: string(name='QuotaId', description='Quota Id', example='quotamtl37ge7gkvdz'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model DeleteQuotaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteQuotaResponseBody(name='body'),
}

/**
 * @summary 删除Quota
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteQuotaResponse
 */
async function deleteQuotaWithOptions(QuotaId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteQuotaResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteQuota',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/quotas/${OpenApiUtil.getEncodeParam(QuotaId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除Quota
 *
 * @return DeleteQuotaResponse
 */
async function deleteQuota(QuotaId: string): DeleteQuotaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteQuotaWithOptions(QuotaId, headers, runtime);
}

model DeleteResourceGroupResponseBody = {
  requestId?: string(name='RequestId', example='F082BD0D-21E1-5F9B-81A0-AB07485B03CD'),
  resourceGroupID?: string(name='ResourceGroupID', example='rgvl9d6utwcscukh'),
}

model DeleteResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteResourceGroupResponseBody(name='body'),
}

/**
 * @summary 删除资源组
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteResourceGroupResponse
 */
async function deleteResourceGroupWithOptions(ResourceGroupID: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteResourceGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteResourceGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除资源组
 *
 * @return DeleteResourceGroupResponse
 */
async function deleteResourceGroup(ResourceGroupID: string): DeleteResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteResourceGroupWithOptions(ResourceGroupID, headers, runtime);
}

model DeleteResourceGroupMachineGroupResponseBody = {
  machineGroupID?: string(name='MachineGroupID'),
  requestId?: string(name='RequestId'),
}

model DeleteResourceGroupMachineGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteResourceGroupMachineGroupResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI DeleteResourceGroupMachineGroup is deprecated
 *
 * @summary delete machine group
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteResourceGroupMachineGroupResponse
 */
// Deprecated
async function deleteResourceGroupMachineGroupWithOptions(MachineGroupID: string, ResourceGroupID: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteResourceGroupMachineGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteResourceGroupMachineGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}/machinegroups/${OpenApiUtil.getEncodeParam(MachineGroupID)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI DeleteResourceGroupMachineGroup is deprecated
 *
 * @summary delete machine group
 *
 * @return DeleteResourceGroupMachineGroupResponse
 */
// Deprecated
async function deleteResourceGroupMachineGroup(MachineGroupID: string, ResourceGroupID: string): DeleteResourceGroupMachineGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteResourceGroupMachineGroupWithOptions(MachineGroupID, ResourceGroupID, headers, runtime);
}

model DeleteTrainingJobResponseBody = {
  requestId?: string(name='RequestId', example='4cc83062-9bcb-4ab3-979e-2e571a35834f'),
}

model DeleteTrainingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTrainingJobResponseBody(name='body'),
}

/**
 * @summary 删除一个TrainingJob
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTrainingJobResponse
 */
async function deleteTrainingJobWithOptions(TrainingJobId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTrainingJobResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTrainingJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除一个TrainingJob
 *
 * @return DeleteTrainingJobResponse
 */
async function deleteTrainingJob(TrainingJobId: string): DeleteTrainingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTrainingJobWithOptions(TrainingJobId, headers, runtime);
}

model DeleteTrainingJobLabelsRequest {
  keys?: string(name='Keys', description='This parameter is required.', example='RootModelID'),
}

model DeleteTrainingJobLabelsResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model DeleteTrainingJobLabelsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTrainingJobLabelsResponseBody(name='body'),
}

/**
 * @summary 删除TrainingJob的Labels
 *
 * @param request DeleteTrainingJobLabelsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTrainingJobLabelsResponse
 */
async function deleteTrainingJobLabelsWithOptions(TrainingJobId: string, request: DeleteTrainingJobLabelsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTrainingJobLabelsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.keys)) {
    query['Keys'] = request.keys;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTrainingJobLabels',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/labels`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除TrainingJob的Labels
 *
 * @param request DeleteTrainingJobLabelsRequest
 * @return DeleteTrainingJobLabelsResponse
 */
async function deleteTrainingJobLabels(TrainingJobId: string, request: DeleteTrainingJobLabelsRequest): DeleteTrainingJobLabelsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTrainingJobLabelsWithOptions(TrainingJobId, request, headers, runtime);
}

model GetAlgorithmResponseBody = {
  algorithmDescription?: string(name='AlgorithmDescription'),
  algorithmId?: string(name='AlgorithmId', example='algo-xsldfvu1334'),
  algorithmName?: string(name='AlgorithmName', example='llm_training'),
  algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
  displayName?: string(name='DisplayName', example='llm_training'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2024-07-10T11:49:47Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2024-07-10T11:49:47Z'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  tenantId?: string(name='TenantId', example='123456789'),
  userId?: string(name='UserId', example='123456789'),
  workspaceId?: string(name='WorkspaceId', example='12345'),
}

model GetAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAlgorithmResponseBody(name='body'),
}

/**
 * @summary 获取一个算法信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAlgorithmResponse
 */
async function getAlgorithmWithOptions(AlgorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetAlgorithmResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetAlgorithm',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取一个算法信息
 *
 * @return GetAlgorithmResponse
 */
async function getAlgorithm(AlgorithmId: string): GetAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAlgorithmWithOptions(AlgorithmId, headers, runtime);
}

model GetAlgorithmVersionResponseBody = {
  algorithmId?: string(name='AlgorithmId', example='algo-xsldfvu1334'),
  algorithmName?: string(name='AlgorithmName', example='llm_training'),
  algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
  algorithmSpec?: AlgorithmSpec(name='AlgorithmSpec'),
  algorithmVersion?: string(name='AlgorithmVersion', example='v0.0.1'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2024-07-10T11:49:47Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2024-07-10T11:49:47Z'),
  tenantId?: string(name='TenantId', example='123456789'),
  userId?: string(name='UserId', example='123456789'),
}

model GetAlgorithmVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAlgorithmVersionResponseBody(name='body'),
}

/**
 * @summary 创建一个新的算法版本
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAlgorithmVersionResponse
 */
async function getAlgorithmVersionWithOptions(AlgorithmId: string, AlgorithmVersion: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetAlgorithmVersionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetAlgorithmVersion',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}/versions/${OpenApiUtil.getEncodeParam(AlgorithmVersion)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建一个新的算法版本
 *
 * @return GetAlgorithmVersionResponse
 */
async function getAlgorithmVersion(AlgorithmId: string, AlgorithmVersion: string): GetAlgorithmVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAlgorithmVersionWithOptions(AlgorithmId, AlgorithmVersion, headers, runtime);
}

model GetMachineGroupResponseBody = {
  count?: long(name='Count'),
  defaultDriver?: string(name='DefaultDriver'),
  duration?: string(name='Duration'),
  ecsType?: string(name='EcsType'),
  gmtCreated?: string(name='GmtCreated'),
  gmtExpired?: string(name='GmtExpired'),
  gmtModified?: string(name='GmtModified'),
  gmtStarted?: string(name='GmtStarted'),
  machineGroupID?: string(name='MachineGroupID'),
  orderID?: string(name='OrderID'),
  orderInstanceId?: string(name='OrderInstanceId'),
  PAIResourceID?: string(name='PAIResourceID'),
  payType?: string(name='PayType'),
  pricingCycle?: string(name='PricingCycle'),
  regionID?: string(name='RegionID'),
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
  supportedDrivers?: [ string ](name='SupportedDrivers'),
}

model GetMachineGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMachineGroupResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI GetMachineGroup is deprecated
 *
 * @summary get machine group
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMachineGroupResponse
 */
// Deprecated
async function getMachineGroupWithOptions(MachineGroupID: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetMachineGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetMachineGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/machinegroups/${OpenApiUtil.getEncodeParam(MachineGroupID)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI GetMachineGroup is deprecated
 *
 * @summary get machine group
 *
 * @return GetMachineGroupResponse
 */
// Deprecated
async function getMachineGroup(MachineGroupID: string): GetMachineGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getMachineGroupWithOptions(MachineGroupID, headers, runtime);
}

model GetNodeMetricsRequest {
  endTime?: string(name='EndTime', example='2024-07-10T10:17:06'),
  GPUType?: string(name='GPUType', example='V100'),
  startTime?: string(name='StartTime', example='2024-07-08T02:23:30.292Z'),
  timeStep?: string(name='TimeStep', example='1h'),
  verbose?: boolean(name='Verbose', example='true'),
}

model GetNodeMetricsResponseBody = {
  metricType?: string(name='MetricType', example='DiskWriteRate'),
  nodesMetrics?: [
    NodeMetric
  ](name='NodesMetrics'),
  resourceGroupID?: string(name='ResourceGroupID', example='rgf0zhfqn1d4ity2'),
}

model GetNodeMetricsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetNodeMetricsResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI GetNodeMetrics is deprecated
 *
 * @summary get resource group node metrics
 *
 * @param request GetNodeMetricsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetNodeMetricsResponse
 */
// Deprecated
async function getNodeMetricsWithOptions(ResourceGroupID: string, MetricType: string, request: GetNodeMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetNodeMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.GPUType)) {
    query['GPUType'] = request.GPUType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.timeStep)) {
    query['TimeStep'] = request.timeStep;
  }
  if (!Util.isUnset(request.verbose)) {
    query['Verbose'] = request.verbose;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetNodeMetrics',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}/nodemetrics/${OpenApiUtil.getEncodeParam(MetricType)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI GetNodeMetrics is deprecated
 *
 * @summary get resource group node metrics
 *
 * @param request GetNodeMetricsRequest
 * @return GetNodeMetricsResponse
 */
// Deprecated
async function getNodeMetrics(ResourceGroupID: string, MetricType: string, request: GetNodeMetricsRequest): GetNodeMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getNodeMetricsWithOptions(ResourceGroupID, MetricType, request, headers, runtime);
}

model GetQuotaRequest {
  verbose?: boolean(name='Verbose'),
}

model GetQuotaResponseBody = {
  allocateStrategy?: string(name='AllocateStrategy', example='ByNodeSpec'),
  creatorId?: string(name='CreatorId', example='18846926616'),
  description?: string(name='Description', example='this is a test quota'),
  gmtCreatedTime?: string(name='GmtCreatedTime', example='2023-06-22T00:00:00Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2023-06-22T00:00:00Z'),
  labels?: [
    Label
  ](name='Labels'),
  latestOperationId?: string(name='LatestOperationId', example='operation1234'),
  min?: ResourceSpec(name='Min'),
  parentQuotaId?: string(name='ParentQuotaId', example='quota1ci8g793pgm'),
  queueStrategy?: string(name='QueueStrategy', example='PaiStrategyIntelligent'),
  quotaConfig?: QuotaConfig(name='QuotaConfig'),
  quotaDetails?: QuotaDetails(name='QuotaDetails'),
  quotaId?: string(name='QuotaId', description='Quota Id', example='quotajradxh43rgb'),
  quotaName?: string(name='QuotaName', example='test-quota'),
  reasonCode?: string(name='ReasonCode', example='“”'),
  reasonMessage?: string(name='ReasonMessage', example='“”'),
  requestId?: string(name='RequestId', example='18D5A1C6-14B8-545E-8408-0A7DDB4C6B5E'),
  resourceGroupIds?: [ string ](name='ResourceGroupIds'),
  resourceType?: string(name='ResourceType', example='ECS'),
  status?: string(name='Status', example='Ready'),
  subQuotas?: [
    QuotaIdName
  ](name='SubQuotas'),
  workspaces?: [
    WorkspaceIdName
  ](name='Workspaces'),
}

model GetQuotaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetQuotaResponseBody(name='body'),
}

/**
 * @summary 获取Quota
 *
 * @param request GetQuotaRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetQuotaResponse
 */
async function getQuotaWithOptions(QuotaId: string, request: GetQuotaRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetQuotaResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.verbose)) {
    query['Verbose'] = request.verbose;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetQuota',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/quotas/${OpenApiUtil.getEncodeParam(QuotaId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取Quota
 *
 * @param request GetQuotaRequest
 * @return GetQuotaResponse
 */
async function getQuota(QuotaId: string, request: GetQuotaRequest): GetQuotaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getQuotaWithOptions(QuotaId, request, headers, runtime);
}

model GetResourceGroupRequest {
  isAIWorkspaceDataEnabled?: boolean(name='IsAIWorkspaceDataEnabled', example='true'),
  tag?: [ 
    {
      key?: string(name='Key', example='TestKey'),
      value?: string(name='Value', example='TestValue'),
    }
  ](name='Tag'),
}

model GetResourceGroupShrinkRequest {
  isAIWorkspaceDataEnabled?: boolean(name='IsAIWorkspaceDataEnabled', example='true'),
  tagShrink?: string(name='Tag'),
}

model GetResourceGroupResponseBody = {
  clusterID?: string(name='ClusterID', example='cb2c7bde30b774e46a329c'),
  computingResourceProvider?: string(name='ComputingResourceProvider', example='ECS'),
  creatorID?: string(name='CreatorID', example='1612285282502324'),
  description?: string(name='Description', example='testDescription'),
  gmtCreatedTime?: string(name='GmtCreatedTime', example='2023-06-22T00:00:00Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2023-06-22T00:00:00Z'),
  name?: string(name='Name', example='TestResourceGroup'),
  requestId?: string(name='RequestId', example='18D5A1C6-14B8-545E-8408-0A7DDB4C6B5E'),
  resourceType?: string(name='ResourceType', example='Ecs'),
  status?: string(name='Status', example='Ready'),
  supportRDMA?: boolean(name='SupportRDMA', example='true'),
  tags?: [ 
    {
      tagKey?: string(name='TagKey', example='testKey'),
      tagValue?: string(name='TagValue', example='testValue'),
    }
  ](name='Tags'),
  userVpc?: UserVpc(name='UserVpc'),
  workspaceID?: string(name='WorkspaceID', example='35201'),
}

model GetResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceGroupResponseBody(name='body'),
}

/**
 * @summary get resource group by group id
 *
 * @param tmpReq GetResourceGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceGroupResponse
 */
async function getResourceGroupWithOptions(ResourceGroupID: string, tmpReq: GetResourceGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetResourceGroupResponse {
  Util.validateModel(tmpReq);
  var request = new GetResourceGroupShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tag)) {
    request.tagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tag, 'Tag', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.isAIWorkspaceDataEnabled)) {
    query['IsAIWorkspaceDataEnabled'] = request.isAIWorkspaceDataEnabled;
  }
  if (!Util.isUnset(request.tagShrink)) {
    query['Tag'] = request.tagShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary get resource group by group id
 *
 * @param request GetResourceGroupRequest
 * @return GetResourceGroupResponse
 */
async function getResourceGroup(ResourceGroupID: string, request: GetResourceGroupRequest): GetResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourceGroupWithOptions(ResourceGroupID, request, headers, runtime);
}

model GetResourceGroupMachineGroupRequest {
  tag?: [ 
    {
      key?: string(name='Key', example='TestKey'),
      value?: string(name='Value', example='TestValue'),
    }
  ](name='Tag'),
}

model GetResourceGroupMachineGroupShrinkRequest {
  tagShrink?: string(name='Tag'),
}

model GetResourceGroupMachineGroupResponseBody = {
  cpu?: string(name='Cpu', example='2'),
  defaultDriver?: string(name='DefaultDriver', example='535'),
  ecsCount?: long(name='EcsCount', example='1'),
  ecsSpec?: string(name='EcsSpec', example='ecs.c6.large'),
  gmtCreatedTime?: string(name='GmtCreatedTime', example='2023-06-22T00:00:00Z'),
  gmtExpiredTime?: string(name='GmtExpiredTime', example='2023-06-22T00:00:00Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2023-06-22T00:00:00Z'),
  gmtStartedTime?: string(name='GmtStartedTime', example='2023-06-22T00:00:00Z'),
  gpu?: string(name='Gpu', example='8'),
  gpuType?: string(name='GpuType', example='A100'),
  machineGroupID?: string(name='MachineGroupID', example='mgmioirqjgw6c5lg'),
  memory?: string(name='Memory', example='64'),
  name?: string(name='Name', example='testMachineGroup'),
  paymentDuration?: string(name='PaymentDuration', example='1'),
  paymentDurationUnit?: string(name='PaymentDurationUnit', example='Month'),
  paymentType?: string(name='PaymentType', example='PREPAY'),
  requestId?: string(name='RequestId', example='18D5A1C6-14B8-545E-8408-0A7DDB4C6B5E'),
  resourceGroupID?: string(name='ResourceGroupID', example='rgf0zhfqn1d4ity2'),
  status?: string(name='Status', example='Ready'),
  supportedDrivers?: [ string ](name='SupportedDrivers'),
  tags?: [ 
    {
      tagKey?: string(name='TagKey', example='TestKey'),
      tagValue?: string(name='TagValue', example='TestValue'),
    }
  ](name='Tags'),
}

model GetResourceGroupMachineGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceGroupMachineGroupResponseBody(name='body'),
}

/**
 * @summary get machine group
 *
 * @param tmpReq GetResourceGroupMachineGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceGroupMachineGroupResponse
 */
async function getResourceGroupMachineGroupWithOptions(MachineGroupID: string, ResourceGroupID: string, tmpReq: GetResourceGroupMachineGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetResourceGroupMachineGroupResponse {
  Util.validateModel(tmpReq);
  var request = new GetResourceGroupMachineGroupShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tag)) {
    request.tagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tag, 'Tag', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.tagShrink)) {
    query['Tag'] = request.tagShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceGroupMachineGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}/machinegroups/${OpenApiUtil.getEncodeParam(MachineGroupID)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary get machine group
 *
 * @param request GetResourceGroupMachineGroupRequest
 * @return GetResourceGroupMachineGroupResponse
 */
async function getResourceGroupMachineGroup(MachineGroupID: string, ResourceGroupID: string, request: GetResourceGroupMachineGroupRequest): GetResourceGroupMachineGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourceGroupMachineGroupWithOptions(MachineGroupID, ResourceGroupID, request, headers, runtime);
}

model GetResourceGroupRequestRequest {
  podStatus?: string(name='PodStatus', example='Running', nullable=true),
  resourceGroupID?: string(name='ResourceGroupID', description='This parameter is required.', example='rgf0zhfqn1d4ity2'),
}

model GetResourceGroupRequestResponseBody = {
  requestCPU?: int32(name='requestCPU', example='1'),
  requestGPU?: int32(name='requestGPU', example='8'),
  requestGPUInfos?: [
    GPUInfo
  ](name='requestGPUInfos'),
  requestMemory?: int32(name='requestMemory', example='2'),
}

model GetResourceGroupRequestResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceGroupRequestResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI GetResourceGroupRequest is deprecated
 *
 * @summary get resource group requested resource by resource group id
 *
 * @param request GetResourceGroupRequestRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceGroupRequestResponse
 */
// Deprecated
async function getResourceGroupRequestWithOptions(request: GetResourceGroupRequestRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetResourceGroupRequestResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.podStatus)) {
    query['PodStatus'] = request.podStatus;
  }
  if (!Util.isUnset(request.resourceGroupID)) {
    query['ResourceGroupID'] = request.resourceGroupID;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceGroupRequest',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/data/request`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI GetResourceGroupRequest is deprecated
 *
 * @summary get resource group requested resource by resource group id
 *
 * @param request GetResourceGroupRequestRequest
 * @return GetResourceGroupRequestResponse
 */
// Deprecated
async function getResourceGroupRequest(request: GetResourceGroupRequestRequest): GetResourceGroupRequestResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourceGroupRequestWithOptions(request, headers, runtime);
}

model GetResourceGroupTotalRequest {
  resourceGroupID?: string(name='ResourceGroupID', example='rgf0zhfqn1d4ity2'),
}

model GetResourceGroupTotalResponseBody = {
  totalCPU?: int32(name='totalCPU', example='100'),
  totalGPU?: int32(name='totalGPU', example='24'),
  totalGPUInfos?: [
    GPUInfo
  ](name='totalGPUInfos'),
  totalMemory?: int32(name='totalMemory', example='300'),
}

model GetResourceGroupTotalResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceGroupTotalResponseBody(name='body'),
}

/**
 * @summary get resource group total resource by group id
 *
 * @param request GetResourceGroupTotalRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceGroupTotalResponse
 */
async function getResourceGroupTotalWithOptions(request: GetResourceGroupTotalRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetResourceGroupTotalResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.resourceGroupID)) {
    query['ResourceGroupID'] = request.resourceGroupID;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceGroupTotal',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/data/total`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary get resource group total resource by group id
 *
 * @param request GetResourceGroupTotalRequest
 * @return GetResourceGroupTotalResponse
 */
async function getResourceGroupTotal(request: GetResourceGroupTotalRequest): GetResourceGroupTotalResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourceGroupTotalWithOptions(request, headers, runtime);
}

model GetSpotPriceHistoryRequest {
  endTime?: string(name='EndTime', example='2024-12-30T09:36:46Z'),
  order?: string(name='Order', example='asc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  sortBy?: string(name='SortBy', example='GmtCreatedTime'),
  spotDuration?: int32(name='SpotDuration', example='0'),
  startTime?: string(name='StartTime', example='2024-12-26T09:36:46Z'),
}

model GetSpotPriceHistoryResponseBody = {
  requestId?: string(name='RequestId', example='8BDA4440-DD3C-5F4B-BBDD-94A9CE1E75C7'),
  spotPriceHistory?: [
    SpotPriceItem
  ](name='SpotPriceHistory'),
  totalCount?: int32(name='TotalCount', example='194'),
}

model GetSpotPriceHistoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSpotPriceHistoryResponseBody(name='body'),
}

/**
 * @summary 获取抢占式实例历史价格
 *
 * @param request GetSpotPriceHistoryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSpotPriceHistoryResponse
 */
async function getSpotPriceHistoryWithOptions(InstanceType: string, request: GetSpotPriceHistoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetSpotPriceHistoryResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.spotDuration)) {
    query['SpotDuration'] = request.spotDuration;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSpotPriceHistory',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/spots/${OpenApiUtil.getEncodeParam(InstanceType)}/pricehistory`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取抢占式实例历史价格
 *
 * @param request GetSpotPriceHistoryRequest
 * @return GetSpotPriceHistoryResponse
 */
async function getSpotPriceHistory(InstanceType: string, request: GetSpotPriceHistoryRequest): GetSpotPriceHistoryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSpotPriceHistoryWithOptions(InstanceType, request, headers, runtime);
}

model GetTokenRequest {
  expireTime?: long(name='ExpireTime', example='60'),
  trainingJobId?: string(name='TrainingJobId', description='This parameter is required.', example='traincclrt205dcs'),
}

model GetTokenResponseBody = {
  requestId?: string(name='RequestId', example='F2D0392B-D749-5C48-A98A-3FAE5C9444A6'),
  token?: string(name='Token', example='ql4OU830nJaF17LP6KTry4a9DvnjIXHP'),
}

model GetTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTokenResponseBody(name='body'),
}

/**
 * @summary 调用GetToken获取临时鉴权信息
 *
 * @param request GetTokenRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTokenResponse
 */
async function getTokenWithOptions(request: GetTokenRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTokenResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.expireTime)) {
    query['ExpireTime'] = request.expireTime;
  }
  if (!Util.isUnset(request.trainingJobId)) {
    query['TrainingJobId'] = request.trainingJobId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetToken',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/tokens`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 调用GetToken获取临时鉴权信息
 *
 * @param request GetTokenRequest
 * @return GetTokenResponse
 */
async function getToken(request: GetTokenRequest): GetTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTokenWithOptions(request, headers, runtime);
}

model GetTrainingJobResponseBody = {
  algorithmId?: string(name='AlgorithmId', example='algo-xsldfvu1334'),
  algorithmName?: string(name='AlgorithmName', example='llm_training'),
  algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
  algorithmSpec?: AlgorithmSpec(name='AlgorithmSpec'),
  algorithmVersion?: string(name='AlgorithmVersion', example='v0.0.1'),
  computeResource?: {
    ecsCount?: long(name='EcsCount', example='1'),
    ecsSpec?: string(name='EcsSpec', example='ecs.gn5-c8g1.2xlarge'),
    instanceCount?: long(name='InstanceCount', example='1'),
    instanceSpec?: {
      CPU?: string(name='CPU', example='8'),
      GPU?: string(name='GPU', example='1'),
      GPUType?: string(name='GPUType', example='V100'),
      memory?: string(name='Memory', example='32'),
      sharedMemory?: string(name='SharedMemory', example='32'),
    }(name='InstanceSpec'),
    resourceId?: string(name='ResourceId', example='quotam670lixikcl'),
    resourceName?: string(name='ResourceName'),
    spotSpec?: {
      spotDiscountLimit?: float(name='SpotDiscountLimit', example='0.9'),
      spotStrategy?: string(name='SpotStrategy', example='SpotWithPriceLimit'),
    }(name='SpotSpec'),
    useSpotInstance?: boolean(name='UseSpotInstance', example='true'),
  }(name='ComputeResource'),
  duration?: long(name='Duration', example='7200'),
  environments?: map[string]string(name='Environments'),
  experimentConfig?: {
    experimentId?: string(name='ExperimentId', example='exp-ds9aefia90v'),
    experimentName?: string(name='ExperimentName', example='large_language_model_train'),
  }(name='ExperimentConfig'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2024-07-10T11:49:47Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2024-07-10T11:49:47Z'),
  hyperParameters?: [ 
    {
      name?: string(name='Name', example='learning_rate'),
      value?: string(name='Value', example='0.0001'),
    }
  ](name='HyperParameters'),
  inputChannels?: [ 
    {
      datasetId?: string(name='DatasetId', example='d-475megosidivjfgfq6'),
      inputUri?: string(name='InputUri', example='oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/input/model/'),
      name?: string(name='Name', example='model'),
      options?: string(name='Options'),
      versionName?: string(name='VersionName'),
    }
  ](name='InputChannels'),
  instances?: [ 
    {
      name?: string(name='Name', example='train1oug3yehan4-master-0'),
      role?: string(name='Role', example='master'),
      status?: string(name='Status', example='Succeeded'),
    }
  ](name='Instances'),
  isTempAlgo?: boolean(name='IsTempAlgo', example='true'),
  labels?: [ 
    {
      key?: string(name='Key', example='CreatedBy'),
      value?: string(name='Value', example='QuickStart'),
    }
  ](name='Labels'),
  latestMetrics?: [ 
    {
      name?: string(name='Name', example='loss'),
      timestamp?: string(name='Timestamp', example='2024-07-10T11:49:47Z'),
      value?: double(name='Value', example='0.11'),
    }
  ](name='LatestMetrics'),
  latestProgress?: {
    overallProgress?: {
      timestamp?: string(name='Timestamp', example='2023-07-04T13:20:18Z'),
      value?: float(name='Value', example='0.75'),
    }(name='OverallProgress'),
    remainingTime?: {
      timestamp?: string(name='Timestamp', example='2023-07-04T13:20:18Z'),
      value?: long(name='Value', example='3600'),
    }(name='RemainingTime'),
  }(name='LatestProgress'),
  outputChannels?: [ 
    {
      datasetId?: string(name='DatasetId', example='d-8o0hh35po15ejcdq2p'),
      name?: string(name='Name', example='model'),
      outputUri?: string(name='OutputUri', example='oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/output/model/'),
      versionName?: string(name='VersionName'),
    }
  ](name='OutputChannels'),
  outputModel?: {
    outputChannelName?: string(name='OutputChannelName', example='model'),
    uri?: string(name='Uri', example='oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/model/output/'),
  }(name='OutputModel'),
  priority?: int32(name='Priority'),
  pythonRequirements?: [ string ](name='PythonRequirements'),
  reasonCode?: string(name='ReasonCode', example='TrainingJobSucceed'),
  reasonMessage?: string(name='ReasonMessage', example='None'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  roleArn?: string(name='RoleArn', example='acs:ram::{accountID}:role/{roleName}'),
  scheduler?: {
    maxRunningTimeInMinutes?: string(name='MaxRunningTimeInMinutes'),
    maxRunningTimeInSeconds?: string(name='MaxRunningTimeInSeconds', example='0'),
  }(name='Scheduler'),
  settings?: JobSettings(name='Settings'),
  status?: string(name='Status', example='Running'),
  statusTransitions?: [ 
    {
      endTime?: string(name='EndTime', example='2024-07-10T11:49:47Z'),
      reasonCode?: string(name='ReasonCode', example='TrainingJobSucceed'),
      reasonMessage?: string(name='ReasonMessage', example='KubeDL job runs successfully'),
      startTime?: string(name='StartTime', example='2024-07-10T11:49:47Z'),
      status?: string(name='Status', example='Creating'),
    }
  ](name='StatusTransitions'),
  trainingJobDescription?: string(name='TrainingJobDescription'),
  trainingJobId?: string(name='TrainingJobId', example='traini6hhxiq69eo'),
  trainingJobName?: string(name='TrainingJobName', example='qwen_llm'),
  trainingJobUrl?: string(name='TrainingJobUrl', example='https://pai.console.aliyun.com/?regionId=cn-hangzhou&workspaceId=1234#/training/jobs/train1ouyadsl8n4'),
  userId?: string(name='UserId', example='123456789'),
  userVpc?: {
    extendedCIDRs?: [ string ](name='ExtendedCIDRs'),
    securityGroupId?: string(name='SecurityGroupId', example='sg-abcdef****'),
    switchId?: string(name='SwitchId', example='vs-abcdef****'),
    vpcId?: string(name='VpcId', description='VPC ID。', example='vpc-abcdef****'),
  }(name='UserVpc'),
  workspaceId?: string(name='WorkspaceId', example='86995'),
}

model GetTrainingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTrainingJobResponseBody(name='body'),
}

/**
 * @summary 获取TrainingJob的详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTrainingJobResponse
 */
async function getTrainingJobWithOptions(TrainingJobId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTrainingJobResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTrainingJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取TrainingJob的详情
 *
 * @return GetTrainingJobResponse
 */
async function getTrainingJob(TrainingJobId: string): GetTrainingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTrainingJobWithOptions(TrainingJobId, headers, runtime);
}

model GetTrainingJobErrorInfoResponseBody = {
  errorInfo?: {
    additionalInfo?: string(name='AdditionalInfo', example='additional info'),
    code?: string(name='Code', example='200'),
    message?: string(name='Message', example='success'),
  }(name='ErrorInfo'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model GetTrainingJobErrorInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTrainingJobErrorInfoResponseBody(name='body'),
}

/**
 * @summary 获取Training Job的算法错误信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTrainingJobErrorInfoResponse
 */
async function getTrainingJobErrorInfoWithOptions(TrainingJobId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTrainingJobErrorInfoResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTrainingJobErrorInfo',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/errorinfo`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取Training Job的算法错误信息
 *
 * @return GetTrainingJobErrorInfoResponse
 */
async function getTrainingJobErrorInfo(TrainingJobId: string): GetTrainingJobErrorInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTrainingJobErrorInfoWithOptions(TrainingJobId, headers, runtime);
}

model GetTrainingJobLatestMetricsRequest {
  names?: string(name='Names', example='loss'),
}

model GetTrainingJobLatestMetricsResponseBody = {
  metrics?: [ 
    {
      name?: string(name='Name', example='loss'),
      timestamp?: string(name='Timestamp', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2022-04-18T22:20:55Z'),
      value?: double(name='Value', example='0.97'),
    }
  ](name='Metrics'),
  requestId?: string(name='RequestId', example='18D5A1C6-14B8-545E-8408-0A7DDB4C6B5E'),
}

model GetTrainingJobLatestMetricsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTrainingJobLatestMetricsResponseBody(name='body'),
}

/**
 * @summary 获取TrainingJob最近的Metrics
 *
 * @param request GetTrainingJobLatestMetricsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTrainingJobLatestMetricsResponse
 */
async function getTrainingJobLatestMetricsWithOptions(TrainingJobId: string, request: GetTrainingJobLatestMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTrainingJobLatestMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.names)) {
    query['Names'] = request.names;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTrainingJobLatestMetrics',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/latestmetrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取TrainingJob最近的Metrics
 *
 * @param request GetTrainingJobLatestMetricsRequest
 * @return GetTrainingJobLatestMetricsResponse
 */
async function getTrainingJobLatestMetrics(TrainingJobId: string, request: GetTrainingJobLatestMetricsRequest): GetTrainingJobLatestMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTrainingJobLatestMetricsWithOptions(TrainingJobId, request, headers, runtime);
}

model GetUserViewMetricsRequest {
  order?: string(name='Order', example='DESC'),
  pageNumber?: string(name='PageNumber', description='This parameter is required.', example='1'),
  pageSize?: string(name='PageSize', description='This parameter is required.', example='10'),
  sortBy?: string(name='SortBy', example='GmtModified'),
  timeStep?: string(name='TimeStep', example='1h'),
  userId?: string(name='UserId', example='123456'),
  workspaceId?: string(name='WorkspaceId', example='86995'),
}

model GetUserViewMetricsResponseBody = {
  resourceGroupId?: string(name='ResourceGroupId', example='rgf0zhfqn1d4ity2'),
  summary?: UserViewMetric(name='Summary'),
  total?: int32(name='Total', example='2'),
  userMetrics?: [
    UserViewMetric
  ](name='UserMetrics'),
}

model GetUserViewMetricsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetUserViewMetricsResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI GetUserViewMetrics is deprecated
 *
 * @summary get user view  metrics
 *
 * @param request GetUserViewMetricsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetUserViewMetricsResponse
 */
// Deprecated
async function getUserViewMetricsWithOptions(ResourceGroupID: string, request: GetUserViewMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetUserViewMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.timeStep)) {
    query['TimeStep'] = request.timeStep;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetUserViewMetrics',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}/usermetrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI GetUserViewMetrics is deprecated
 *
 * @summary get user view  metrics
 *
 * @param request GetUserViewMetricsRequest
 * @return GetUserViewMetricsResponse
 */
// Deprecated
async function getUserViewMetrics(ResourceGroupID: string, request: GetUserViewMetricsRequest): GetUserViewMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getUserViewMetricsWithOptions(ResourceGroupID, request, headers, runtime);
}

model ListAlgorithmVersionsRequest {
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
}

model ListAlgorithmVersionsResponseBody = {
  algorithmVersions?: [ 
    {
      algorithmId?: string(name='AlgorithmId', example='algo-sidjc8134hv'),
      algorithmName?: string(name='AlgorithmName', example='llm_train'),
      algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
      algorithmVersion?: string(name='AlgorithmVersion', example='v0.1.0'),
      gmtCreateTime?: string(name='GmtCreateTime', example='2024-01-19T02:00:26Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2024-01-22T02:00:59Z'),
      tenantId?: string(name='TenantId', example='123456789'),
      userId?: string(name='UserId', example='123456789'),
    }
  ](name='AlgorithmVersions'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  totalCount?: long(name='TotalCount', example='23'),
}

model ListAlgorithmVersionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAlgorithmVersionsResponseBody(name='body'),
}

/**
 * @summary 获取算法的所有版本信息
 *
 * @param request ListAlgorithmVersionsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAlgorithmVersionsResponse
 */
async function listAlgorithmVersionsWithOptions(AlgorithmId: string, request: ListAlgorithmVersionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListAlgorithmVersionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAlgorithmVersions',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}/versions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取算法的所有版本信息
 *
 * @param request ListAlgorithmVersionsRequest
 * @return ListAlgorithmVersionsResponse
 */
async function listAlgorithmVersions(AlgorithmId: string, request: ListAlgorithmVersionsRequest): ListAlgorithmVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listAlgorithmVersionsWithOptions(AlgorithmId, request, headers, runtime);
}

model ListAlgorithmsRequest {
  algorithmId?: string(name='AlgorithmId', example='algo-xsldfvu1334'),
  algorithmName?: string(name='AlgorithmName', example='llm_training'),
  algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  workspaceId?: string(name='WorkspaceId', example='12345'),
}

model ListAlgorithmsResponseBody = {
  algorithms?: [ 
    {
      algorithmDescription?: string(name='AlgorithmDescription'),
      algorithmId?: string(name='AlgorithmId', example='algo-sidjc8134hv'),
      algorithmName?: string(name='AlgorithmName', example='llm_train'),
      algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
      displayName?: string(name='DisplayName', example='LLM Train'),
      gmtCreateTime?: string(name='GmtCreateTime', example='2023-07-21T03:35:24Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2023-07-25T02:15:40Z'),
      userId?: string(name='UserId', example='123456789'),
      workspaceId?: string(name='WorkspaceId', example='12345'),
    }
  ](name='Algorithms'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  totalCount?: long(name='TotalCount', example='4'),
}

model ListAlgorithmsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAlgorithmsResponseBody(name='body'),
}

/**
 * @summary 获取算法列表
 *
 * @param request ListAlgorithmsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAlgorithmsResponse
 */
async function listAlgorithmsWithOptions(request: ListAlgorithmsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListAlgorithmsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.algorithmId)) {
    query['AlgorithmId'] = request.algorithmId;
  }
  if (!Util.isUnset(request.algorithmName)) {
    query['AlgorithmName'] = request.algorithmName;
  }
  if (!Util.isUnset(request.algorithmProvider)) {
    query['AlgorithmProvider'] = request.algorithmProvider;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAlgorithms',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取算法列表
 *
 * @param request ListAlgorithmsRequest
 * @return ListAlgorithmsResponse
 */
async function listAlgorithms(request: ListAlgorithmsRequest): ListAlgorithmsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listAlgorithmsWithOptions(request, headers, runtime);
}

model ListNodesRequest {
  acceleratorType?: string(name='AcceleratorType', example='CPU'),
  filterByQuotaId?: string(name='FilterByQuotaId', example='quotamtl37ge7gkvdz'),
  filterByResourceGroupIds?: string(name='FilterByResourceGroupIds', example='rg69rj0leslwdnbe'),
  GPUType?: string(name='GPUType', example='T4'),
  machineGroupIds?: string(name='MachineGroupIds'),
  nodeNames?: string(name='NodeNames', example='lingjxxxx'),
  nodeStatuses?: string(name='NodeStatuses', example='Ready'),
  nodeTypes?: string(name='NodeTypes', example='ecs.c6.xlarge'),
  order?: string(name='Order', example='desc'),
  orderStatuses?: string(name='OrderStatuses', example='Ready'),
  pageNumber?: int32(name='PageNumber', example='2'),
  pageSize?: int32(name='PageSize', example='10'),
  quotaId?: string(name='QuotaId', example='quotamtl37ge7gkvdz'),
  reasonCodes?: string(name='ReasonCodes'),
  resourceGroupIds?: string(name='ResourceGroupIds', example='rg69rj0leslwdnbe'),
  sortBy?: string(name='SortBy', example='GmtCreateTime'),
  verbose?: boolean(name='Verbose', example='false'),
}

model ListNodesResponseBody = {
  nodes?: [
    Node
  ](name='Nodes'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  totalCount?: int32(name='TotalCount', example='23'),
}

model ListNodesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListNodesResponseBody(name='body'),
}

/**
 * @summary 获取资源节点列表
 *
 * @param request ListNodesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListNodesResponse
 */
async function listNodesWithOptions(request: ListNodesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListNodesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.acceleratorType)) {
    query['AcceleratorType'] = request.acceleratorType;
  }
  if (!Util.isUnset(request.filterByQuotaId)) {
    query['FilterByQuotaId'] = request.filterByQuotaId;
  }
  if (!Util.isUnset(request.filterByResourceGroupIds)) {
    query['FilterByResourceGroupIds'] = request.filterByResourceGroupIds;
  }
  if (!Util.isUnset(request.GPUType)) {
    query['GPUType'] = request.GPUType;
  }
  if (!Util.isUnset(request.machineGroupIds)) {
    query['MachineGroupIds'] = request.machineGroupIds;
  }
  if (!Util.isUnset(request.nodeNames)) {
    query['NodeNames'] = request.nodeNames;
  }
  if (!Util.isUnset(request.nodeStatuses)) {
    query['NodeStatuses'] = request.nodeStatuses;
  }
  if (!Util.isUnset(request.nodeTypes)) {
    query['NodeTypes'] = request.nodeTypes;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.orderStatuses)) {
    query['OrderStatuses'] = request.orderStatuses;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.quotaId)) {
    query['QuotaId'] = request.quotaId;
  }
  if (!Util.isUnset(request.reasonCodes)) {
    query['ReasonCodes'] = request.reasonCodes;
  }
  if (!Util.isUnset(request.resourceGroupIds)) {
    query['ResourceGroupIds'] = request.resourceGroupIds;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.verbose)) {
    query['Verbose'] = request.verbose;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListNodes',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/nodes`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取资源节点列表
 *
 * @param request ListNodesRequest
 * @return ListNodesResponse
 */
async function listNodes(request: ListNodesRequest): ListNodesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listNodesWithOptions(request, headers, runtime);
}

model ListQuotaWorkloadsRequest {
  beforeWorkloadId?: string(name='BeforeWorkloadId', example='dsw65443322'),
  gmtDequeuedTimeRange?: TimeRangeFilter(name='GmtDequeuedTimeRange'),
  gmtEnqueuedTimeRange?: TimeRangeFilter(name='GmtEnqueuedTimeRange'),
  gmtPositionModifiedTimeRange?: TimeRangeFilter(name='GmtPositionModifiedTimeRange'),
  nodeName?: string(name='NodeName', example='lrn48278127617'),
  order?: string(name='Order', example='desc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  showOwn?: boolean(name='ShowOwn', example='true'),
  sortBy?: string(name='SortBy', example='GmtCreatedTime'),
  status?: string(name='Status', example='Enqueued'),
  subQuotaIds?: string(name='SubQuotaIds', example='quota12344666,quota64432233'),
  userIds?: string(name='UserIds', example='29043893812,23829093093'),
  withHistoricalData?: boolean(name='WithHistoricalData'),
  workloadCreatedTimeRange?: TimeRangeFilter(name='WorkloadCreatedTimeRange'),
  workloadIds?: string(name='WorkloadIds', example='dlc12344556'),
  workloadStatuses?: string(name='WorkloadStatuses', example='Pending'),
  workloadType?: string(name='WorkloadType', example='dlc'),
  workspaceIds?: string(name='WorkspaceIds', example='186692'),
}

model ListQuotaWorkloadsResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request', example='42F23B58-3684-5443-848A-8DA81FF99712'),
  totalCount?: long(name='TotalCount', example='23'),
  workloads?: [
    QueueInfo
  ](name='Workloads'),
}

model ListQuotaWorkloadsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListQuotaWorkloadsResponseBody(name='body'),
}

/**
 * @summary 您可以通过此API获取Quota上的任务信息列表
 *
 * @param request ListQuotaWorkloadsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListQuotaWorkloadsResponse
 */
async function listQuotaWorkloadsWithOptions(QuotaId: string, request: ListQuotaWorkloadsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListQuotaWorkloadsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.beforeWorkloadId)) {
    query['BeforeWorkloadId'] = request.beforeWorkloadId;
  }
  if (!Util.isUnset(request.gmtDequeuedTimeRange)) {
    query['GmtDequeuedTimeRange'] = request.gmtDequeuedTimeRange;
  }
  if (!Util.isUnset(request.gmtEnqueuedTimeRange)) {
    query['GmtEnqueuedTimeRange'] = request.gmtEnqueuedTimeRange;
  }
  if (!Util.isUnset(request.gmtPositionModifiedTimeRange)) {
    query['GmtPositionModifiedTimeRange'] = request.gmtPositionModifiedTimeRange;
  }
  if (!Util.isUnset(request.nodeName)) {
    query['NodeName'] = request.nodeName;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.showOwn)) {
    query['ShowOwn'] = request.showOwn;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.subQuotaIds)) {
    query['SubQuotaIds'] = request.subQuotaIds;
  }
  if (!Util.isUnset(request.userIds)) {
    query['UserIds'] = request.userIds;
  }
  if (!Util.isUnset(request.withHistoricalData)) {
    query['WithHistoricalData'] = request.withHistoricalData;
  }
  if (!Util.isUnset(request.workloadCreatedTimeRange)) {
    query['WorkloadCreatedTimeRange'] = request.workloadCreatedTimeRange;
  }
  if (!Util.isUnset(request.workloadIds)) {
    query['WorkloadIds'] = request.workloadIds;
  }
  if (!Util.isUnset(request.workloadStatuses)) {
    query['WorkloadStatuses'] = request.workloadStatuses;
  }
  if (!Util.isUnset(request.workloadType)) {
    query['WorkloadType'] = request.workloadType;
  }
  if (!Util.isUnset(request.workspaceIds)) {
    query['WorkspaceIds'] = request.workspaceIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListQuotaWorkloads',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/quotas/${OpenApiUtil.getEncodeParam(QuotaId)}/workloads`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 您可以通过此API获取Quota上的任务信息列表
 *
 * @param request ListQuotaWorkloadsRequest
 * @return ListQuotaWorkloadsResponse
 */
async function listQuotaWorkloads(QuotaId: string, request: ListQuotaWorkloadsRequest): ListQuotaWorkloadsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listQuotaWorkloadsWithOptions(QuotaId, request, headers, runtime);
}

model ListQuotasRequest {
  labels?: string(name='Labels', example='official=true,gpu=false'),
  layoutMode?: string(name='LayoutMode'),
  order?: string(name='Order', example='desc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  parentQuotaId?: string(name='ParentQuotaId', example='quotajradxh43rgb'),
  quotaIds?: string(name='QuotaIds', example='quota1ci8g793pgm,quotajradxh43rgb'),
  quotaName?: string(name='QuotaName', example='quotajradxh43rgb'),
  resourceType?: string(name='ResourceType', example='ECS'),
  sortBy?: string(name='SortBy', example='status'),
  statuses?: string(name='Statuses', example='Creating'),
  verbose?: boolean(name='Verbose'),
  workspaceIds?: string(name='WorkspaceIds', example='21345,38727'),
  workspaceName?: string(name='WorkspaceName'),
}

model ListQuotasResponseBody = {
  quotas?: [
    Quota
  ](name='Quotas'),
  requestId?: string(name='RequestId', example='F082BD0D-21E1-5F9B-81A0-AB07485B03CD'),
  totalCount?: int32(name='TotalCount'),
}

model ListQuotasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListQuotasResponseBody(name='body'),
}

/**
 * @summary 获取Quota列表
 *
 * @param request ListQuotasRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListQuotasResponse
 */
async function listQuotasWithOptions(request: ListQuotasRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListQuotasResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.labels)) {
    query['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.layoutMode)) {
    query['LayoutMode'] = request.layoutMode;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.parentQuotaId)) {
    query['ParentQuotaId'] = request.parentQuotaId;
  }
  if (!Util.isUnset(request.quotaIds)) {
    query['QuotaIds'] = request.quotaIds;
  }
  if (!Util.isUnset(request.quotaName)) {
    query['QuotaName'] = request.quotaName;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.statuses)) {
    query['Statuses'] = request.statuses;
  }
  if (!Util.isUnset(request.verbose)) {
    query['Verbose'] = request.verbose;
  }
  if (!Util.isUnset(request.workspaceIds)) {
    query['WorkspaceIds'] = request.workspaceIds;
  }
  if (!Util.isUnset(request.workspaceName)) {
    query['WorkspaceName'] = request.workspaceName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListQuotas',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/quotas/`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取Quota列表
 *
 * @param request ListQuotasRequest
 * @return ListQuotasResponse
 */
async function listQuotas(request: ListQuotasRequest): ListQuotasResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listQuotasWithOptions(request, headers, runtime);
}

model ListResourceGroupMachineGroupsRequest {
  creatorID?: string(name='CreatorID', example='1612285282502326'),
  ecsSpec?: string(name='EcsSpec', example='ecs.c6.large'),
  machineGroupIDs?: string(name='MachineGroupIDs'),
  name?: string(name='Name', example='test'),
  order?: string(name='Order', example='DESC'),
  orderInstanceId?: string(name='OrderInstanceId', example='236553689400333'),
  pageNumber?: int32(name='PageNumber', example='2'),
  pageSize?: int32(name='PageSize', example='10'),
  paymentDuration?: string(name='PaymentDuration', example='1'),
  paymentDurationUnit?: string(name='PaymentDurationUnit', example='Month'),
  paymentType?: string(name='PaymentType', example='PREPAY'),
  sortBy?: string(name='SortBy', example='GmtCreatedTime'),
  status?: string(name='Status', example='Ready'),
}

model ListResourceGroupMachineGroupsResponseBody = {
  machineGroups?: [
    MachineGroup
  ](name='MachineGroups'),
  requestId?: string(name='RequestId', example='E7C42CC7-2E85-508A-84F4-923B605FD10F'),
  totalCount?: string(name='TotalCount', example='4'),
}

model ListResourceGroupMachineGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListResourceGroupMachineGroupsResponseBody(name='body'),
}

/**
 * @summary list machine groups
 *
 * @param request ListResourceGroupMachineGroupsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListResourceGroupMachineGroupsResponse
 */
async function listResourceGroupMachineGroupsWithOptions(ResourceGroupID: string, request: ListResourceGroupMachineGroupsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListResourceGroupMachineGroupsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.creatorID)) {
    query['CreatorID'] = request.creatorID;
  }
  if (!Util.isUnset(request.ecsSpec)) {
    query['EcsSpec'] = request.ecsSpec;
  }
  if (!Util.isUnset(request.machineGroupIDs)) {
    query['MachineGroupIDs'] = request.machineGroupIDs;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.orderInstanceId)) {
    query['OrderInstanceId'] = request.orderInstanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.paymentDuration)) {
    query['PaymentDuration'] = request.paymentDuration;
  }
  if (!Util.isUnset(request.paymentDurationUnit)) {
    query['PaymentDurationUnit'] = request.paymentDurationUnit;
  }
  if (!Util.isUnset(request.paymentType)) {
    query['PaymentType'] = request.paymentType;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceGroupMachineGroups',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}/machinegroups`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary list machine groups
 *
 * @param request ListResourceGroupMachineGroupsRequest
 * @return ListResourceGroupMachineGroupsResponse
 */
async function listResourceGroupMachineGroups(ResourceGroupID: string, request: ListResourceGroupMachineGroupsRequest): ListResourceGroupMachineGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listResourceGroupMachineGroupsWithOptions(ResourceGroupID, request, headers, runtime);
}

model ListResourceGroupsRequest {
  computingResourceProvider?: string(name='ComputingResourceProvider', example='Ecs'),
  name?: string(name='Name', example='rgf0zhfqn1d4ity2'),
  order?: string(name='Order', example='desc'),
  pageNumber?: long(name='PageNumber', example='2'),
  pageSize?: long(name='PageSize', example='10'),
  resourceType?: string(name='ResourceType', example='Lingjun'),
  showAll?: boolean(name='ShowAll', example='false'),
  sortBy?: string(name='SortBy', example='DisplayName'),
  status?: string(name='Status', example='Creating'),
}

model ListResourceGroupsResponseBody = {
  requestId?: string(name='RequestId', example='9CFA2665-1FFE-5929-8468-C14C25890486'),
  resourceGroups?: [
    ResourceGroup
  ](name='ResourceGroups', example='RG1'),
  totalCount?: long(name='TotalCount', description='This parameter is required.', example='2'),
}

model ListResourceGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListResourceGroupsResponseBody(name='body'),
}

/**
 * @summary list resource group
 *
 * @param request ListResourceGroupsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListResourceGroupsResponse
 */
async function listResourceGroupsWithOptions(request: ListResourceGroupsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListResourceGroupsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.computingResourceProvider)) {
    query['ComputingResourceProvider'] = request.computingResourceProvider;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.showAll)) {
    query['ShowAll'] = request.showAll;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceGroups',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary list resource group
 *
 * @param request ListResourceGroupsRequest
 * @return ListResourceGroupsResponse
 */
async function listResourceGroups(request: ListResourceGroupsRequest): ListResourceGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listResourceGroupsWithOptions(request, headers, runtime);
}

model ListTrainingJobEventsRequest {
  endTime?: string(name='EndTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='100'),
  startTime?: string(name='StartTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
}

model ListTrainingJobEventsResponseBody = {
  events?: [ string ](name='Events'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  totalCount?: string(name='TotalCount', example='23'),
}

model ListTrainingJobEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrainingJobEventsResponseBody(name='body'),
}

/**
 * @summary 获取指定TrainingJob的事件。
 *
 * @param request ListTrainingJobEventsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrainingJobEventsResponse
 */
async function listTrainingJobEventsWithOptions(TrainingJobId: string, request: ListTrainingJobEventsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobEventsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobEvents',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/events`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取指定TrainingJob的事件。
 *
 * @param request ListTrainingJobEventsRequest
 * @return ListTrainingJobEventsResponse
 */
async function listTrainingJobEvents(TrainingJobId: string, request: ListTrainingJobEventsRequest): ListTrainingJobEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobEventsWithOptions(TrainingJobId, request, headers, runtime);
}

model ListTrainingJobInstanceEventsRequest {
  endTime?: string(name='EndTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='100'),
  startTime?: string(name='StartTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
}

model ListTrainingJobInstanceEventsResponseBody = {
  events?: [ string ](name='Events'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  totalCount?: string(name='TotalCount', example='1'),
}

model ListTrainingJobInstanceEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrainingJobInstanceEventsResponseBody(name='body'),
}

/**
 * @summary 获取指定Instance（TrainingJob的运行单元）的日志。
 *
 * @param request ListTrainingJobInstanceEventsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrainingJobInstanceEventsResponse
 */
async function listTrainingJobInstanceEventsWithOptions(TrainingJobId: string, InstanceId: string, request: ListTrainingJobInstanceEventsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobInstanceEventsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobInstanceEvents',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/events`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取指定Instance（TrainingJob的运行单元）的日志。
 *
 * @param request ListTrainingJobInstanceEventsRequest
 * @return ListTrainingJobInstanceEventsResponse
 */
async function listTrainingJobInstanceEvents(TrainingJobId: string, InstanceId: string, request: ListTrainingJobInstanceEventsRequest): ListTrainingJobInstanceEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobInstanceEventsWithOptions(TrainingJobId, InstanceId, request, headers, runtime);
}

model ListTrainingJobInstanceMetricsRequest {
  endTime?: string(name='EndTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
  instanceId?: string(name='InstanceId', example='trains930928remn-master-0'),
  metricType?: string(name='MetricType', description='This parameter is required.', example='GpuCoreUsage'),
  startTime?: string(name='StartTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
  timeStep?: string(name='TimeStep', example='10s'),
}

model ListTrainingJobInstanceMetricsResponseBody = {
  instanceMetrics?: [ 
    {
      instanceId?: string(name='InstanceId'),
      metrics?: [ 
        {
          time?: string(name='Time'),
          value?: double(name='Value'),
        }
      ](name='Metrics'),
      nodeName?: string(name='NodeName'),
    }
  ](name='InstanceMetrics'),
  requestId?: string(name='RequestId', example='F082BD0D-21E1-5F9B-81A0-AB07485B03CD'),
}

model ListTrainingJobInstanceMetricsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrainingJobInstanceMetricsResponseBody(name='body'),
}

/**
 * @summary 获取Training Job实例的Metrics
 *
 * @param request ListTrainingJobInstanceMetricsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrainingJobInstanceMetricsResponse
 */
async function listTrainingJobInstanceMetricsWithOptions(TrainingJobId: string, request: ListTrainingJobInstanceMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobInstanceMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.timeStep)) {
    query['TimeStep'] = request.timeStep;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobInstanceMetrics',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/instancemetrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取Training Job实例的Metrics
 *
 * @param request ListTrainingJobInstanceMetricsRequest
 * @return ListTrainingJobInstanceMetricsResponse
 */
async function listTrainingJobInstanceMetrics(TrainingJobId: string, request: ListTrainingJobInstanceMetricsRequest): ListTrainingJobInstanceMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobInstanceMetricsWithOptions(TrainingJobId, request, headers, runtime);
}

model ListTrainingJobLogsRequest {
  endTime?: string(name='EndTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
  instanceId?: string(name='InstanceId', example='train129f212o89d-master-0'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='100'),
  startTime?: string(name='StartTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
  workerId?: string(name='WorkerId', example='train129f212o89d-master-0'),
}

model ListTrainingJobLogsResponseBody = {
  logs?: [ string ](name='Logs'),
  requestId?: string(name='RequestId', example='CBF05F13-B24C-5129-9048-4FA684DCD579'),
  totalCount?: string(name='TotalCount', example='23'),
}

model ListTrainingJobLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrainingJobLogsResponseBody(name='body'),
}

/**
 * @summary 获取Training Job的日志
 *
 * @param request ListTrainingJobLogsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrainingJobLogsResponse
 */
async function listTrainingJobLogsWithOptions(TrainingJobId: string, request: ListTrainingJobLogsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobLogsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.workerId)) {
    query['WorkerId'] = request.workerId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobLogs',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/logs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取Training Job的日志
 *
 * @param request ListTrainingJobLogsRequest
 * @return ListTrainingJobLogsResponse
 */
async function listTrainingJobLogs(TrainingJobId: string, request: ListTrainingJobLogsRequest): ListTrainingJobLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobLogsWithOptions(TrainingJobId, request, headers, runtime);
}

model ListTrainingJobMetricsRequest {
  endTime?: string(name='EndTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
  name?: string(name='Name', example='accuracy'),
  order?: string(name='Order', example='DESC'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='100'),
  startTime?: string(name='StartTime', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2020-11-08T16:00:00Z'),
}

model ListTrainingJobMetricsResponseBody = {
  metrics?: [ 
    {
      name?: string(name='Name', example='accuracy'),
      timestamp?: string(name='Timestamp', description='Use the UTC time format: yyyy-MM-ddTHH:mmZ', example='2022-04-18T22:20:55Z'),
      value?: double(name='Value', example='0.97'),
    }
  ](name='Metrics'),
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  totalCount?: long(name='TotalCount'),
}

model ListTrainingJobMetricsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrainingJobMetricsResponseBody(name='body'),
}

/**
 * @summary 获取Training Job的Metrics
 *
 * @param request ListTrainingJobMetricsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrainingJobMetricsResponse
 */
async function listTrainingJobMetricsWithOptions(TrainingJobId: string, request: ListTrainingJobMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobMetrics',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/metrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取Training Job的Metrics
 *
 * @param request ListTrainingJobMetricsRequest
 * @return ListTrainingJobMetricsResponse
 */
async function listTrainingJobMetrics(TrainingJobId: string, request: ListTrainingJobMetricsRequest): ListTrainingJobMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobMetricsWithOptions(TrainingJobId, request, headers, runtime);
}

model ListTrainingJobOutputModelsResponseBody = {
  outputModels?: [ 
    {
      compressionSpec?: map[string]any(name='CompressionSpec'),
      evaluationSpec?: map[string]any(name='EvaluationSpec', example='{}'),
      inferenceSpec?: map[string]any(name='InferenceSpec', example='{}'),
      labels?: [ 
        {
          key?: string(name='Key'),
          value?: string(name='Value', example='StableDiffusion'),
        }
      ](name='Labels'),
      metrics?: map[string]any(name='Metrics', example='{
      "lr": 0.000001,
      "train_loss": 2.6345
}'),
      outputChannelName?: string(name='OutputChannelName', example='model'),
      sourceId?: string(name='SourceId', example='region=cn-shanghai,workspaceId=1345,kind=PipelineRun,id=run-sakdbaskjdf'),
      sourceType?: string(name='SourceType', example='PAIFlow'),
      trainingSpec?: map[string]any(name='TrainingSpec', example='{}'),
      uri?: string(name='Uri', example='oss://test-bucket.oss-cn-hangzhou.aliyuncs.com/path/to/output/channel/'),
    }
  ](name='OutputModels'),
}

model ListTrainingJobOutputModelsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrainingJobOutputModelsResponseBody(name='body'),
}

/**
 * @summary 获取Training Job 产出的所有模型信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrainingJobOutputModelsResponse
 */
async function listTrainingJobOutputModelsWithOptions(TrainingJobId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobOutputModelsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobOutputModels',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/outputmodels`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取Training Job 产出的所有模型信息
 *
 * @return ListTrainingJobOutputModelsResponse
 */
async function listTrainingJobOutputModels(TrainingJobId: string): ListTrainingJobOutputModelsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobOutputModelsWithOptions(TrainingJobId, headers, runtime);
}

model ListTrainingJobsRequest {
  algorithmName?: string(name='AlgorithmName', example='llm_train'),
  algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
  endTime?: string(name='EndTime', example='2023-12-27T02:10:00Z'),
  isTempAlgo?: boolean(name='IsTempAlgo', example='false', nullable=true),
  labels?: map[string]any(name='Labels', example='{"project": "sd-s3"}'),
  order?: string(name='Order', example='DESC'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  sortBy?: string(name='SortBy', example='GmtModifiedTime'),
  startTime?: string(name='StartTime', example='2024-06-22T01:00:00Z'),
  status?: string(name='Status', example='Running'),
  trainingJobId?: string(name='TrainingJobId', example='trains930928remn'),
  trainingJobName?: string(name='TrainingJobName', example='large_language_model_training'),
  workspaceId?: string(name='WorkspaceId', example='12345'),
}

model ListTrainingJobsShrinkRequest {
  algorithmName?: string(name='AlgorithmName', example='llm_train'),
  algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
  endTime?: string(name='EndTime', example='2023-12-27T02:10:00Z'),
  isTempAlgo?: boolean(name='IsTempAlgo', example='false', nullable=true),
  labelsShrink?: string(name='Labels', example='{"project": "sd-s3"}'),
  order?: string(name='Order', example='DESC'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  sortBy?: string(name='SortBy', example='GmtModifiedTime'),
  startTime?: string(name='StartTime', example='2024-06-22T01:00:00Z'),
  status?: string(name='Status', example='Running'),
  trainingJobId?: string(name='TrainingJobId', example='trains930928remn'),
  trainingJobName?: string(name='TrainingJobName', example='large_language_model_training'),
  workspaceId?: string(name='WorkspaceId', example='12345'),
}

model ListTrainingJobsResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
  totalCount?: long(name='TotalCount', example='10'),
  trainingJobs?: [ 
    {
      algorithmName?: string(name='AlgorithmName', example='llm_train'),
      algorithmProvider?: string(name='AlgorithmProvider', example='pai'),
      algorithmVersion?: string(name='AlgorithmVersion', example='v0.0.1'),
      computeResource?: {
        ecsCount?: long(name='EcsCount', example='1'),
        ecsSpec?: string(name='EcsSpec', example='ecs.gn5-c8g1.2xlarge'),
        instanceCount?: long(name='InstanceCount', example='1'),
        instanceSpec?: {
          CPU?: string(name='CPU', example='8'),
          GPU?: string(name='GPU', example='1'),
          GPUType?: string(name='GPUType', example='V100'),
          memory?: string(name='Memory', example='32'),
          sharedMemory?: string(name='SharedMemory', example='32'),
        }(name='InstanceSpec'),
        resourceId?: string(name='ResourceId', example='quotam670lixikcl'),
        resourceName?: string(name='ResourceName'),
      }(name='ComputeResource'),
      dlcJobId?: string(name='DlcJobId'),
      environments?: map[string]string(name='Environments'),
      experimentConfig?: {
        experimentId?: string(name='ExperimentId', example='exp-ds9aefia90v'),
        experimentName?: string(name='ExperimentName', example='large_language_model'),
      }(name='ExperimentConfig'),
      gmtCreateTime?: string(name='GmtCreateTime', example='2024-07-10T11:49:47Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2024-07-10T11:49:47Z'),
      hyperParameters?: [ 
        {
          name?: string(name='Name', example='learning_rate'),
          value?: string(name='Value', example='0.001'),
        }
      ](name='HyperParameters'),
      inputChannels?: [ 
        {
          datasetId?: string(name='DatasetId', example='d-475megosidivjfgfq6'),
          inputUri?: string(name='InputUri', example='oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/input/channel/'),
          name?: string(name='Name', example='model'),
          versionName?: string(name='VersionName'),
        }
      ](name='InputChannels'),
      isTempAlgo?: boolean(name='IsTempAlgo', example='true'),
      labels?: [ 
        {
          key?: string(name='Key', example='CreatedBy'),
          value?: string(name='Value', example='QuickStart'),
        }
      ](name='Labels'),
      outputChannels?: [ 
        {
          datasetId?: string(name='DatasetId', example='d-8o0hh35po15ejcdq2p'),
          name?: string(name='Name', example='model'),
          outputUri?: string(name='OutputUri', example='oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/output/channel/'),
          versionName?: string(name='VersionName'),
        }
      ](name='OutputChannels'),
      pythonRequirements?: [ string ](name='PythonRequirements'),
      reasonCode?: string(name='ReasonCode', example='TrainingJobSucceed'),
      reasonMessage?: string(name='ReasonMessage', example='None'),
      roleArn?: string(name='RoleArn', example='acs:ram::{accountID}:role/{roleName}'),
      scheduler?: {
        maxRunningTimeInSeconds?: long(name='MaxRunningTimeInSeconds', example='0'),
      }(name='Scheduler'),
      status?: string(name='Status', example='Running'),
      statusTransitions?: [ 
        {
          endTime?: string(name='EndTime', example='2024-07-10T11:49:47Z'),
          reasonCode?: string(name='ReasonCode', example='TrainingJobSucceed'),
          reasonMessage?: string(name='ReasonMessage', example='KubeDL job runs successfully'),
          startTime?: string(name='StartTime', example='2024-07-10T11:49:47Z'),
          status?: string(name='Status', example='Creating'),
        }
      ](name='StatusTransitions'),
      trainingJobDescription?: string(name='TrainingJobDescription'),
      trainingJobId?: string(name='TrainingJobId', example='train1layo6js8ra'),
      trainingJobName?: string(name='TrainingJobName', example='qwen2-7b'),
      userId?: string(name='UserId', example='123456789'),
      userVpc?: {
        defaultRoute?: string(name='DefaultRoute', example='eth1'),
        extendedCIDRs?: [ string ](name='ExtendedCIDRs'),
        securityGroupId?: string(name='SecurityGroupId', example='sg-abcdef****'),
        switchId?: string(name='SwitchId', example='vs-abcdef****'),
        vpcId?: string(name='VpcId', description='VPC ID。', example='vpc-abcdef****'),
      }(name='UserVpc'),
      workspaceId?: string(name='WorkspaceId', example='1234'),
    }
  ](name='TrainingJobs'),
}

model ListTrainingJobsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrainingJobsResponseBody(name='body'),
}

/**
 * @summary 获取TrainingJob的列表
 *
 * @param tmpReq ListTrainingJobsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrainingJobsResponse
 */
async function listTrainingJobsWithOptions(tmpReq: ListTrainingJobsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobsResponse {
  Util.validateModel(tmpReq);
  var request = new ListTrainingJobsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.labels)) {
    request.labelsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.labels, 'Labels', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.algorithmName)) {
    query['AlgorithmName'] = request.algorithmName;
  }
  if (!Util.isUnset(request.algorithmProvider)) {
    query['AlgorithmProvider'] = request.algorithmProvider;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.isTempAlgo)) {
    query['IsTempAlgo'] = request.isTempAlgo;
  }
  if (!Util.isUnset(request.labelsShrink)) {
    query['Labels'] = request.labelsShrink;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.trainingJobId)) {
    query['TrainingJobId'] = request.trainingJobId;
  }
  if (!Util.isUnset(request.trainingJobName)) {
    query['TrainingJobName'] = request.trainingJobName;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobs',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取TrainingJob的列表
 *
 * @param request ListTrainingJobsRequest
 * @return ListTrainingJobsResponse
 */
async function listTrainingJobs(request: ListTrainingJobsRequest): ListTrainingJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobsWithOptions(request, headers, runtime);
}

model ScaleQuotaRequest {
  min?: ResourceSpec(name='Min'),
  resourceGroupIds?: [ string ](name='ResourceGroupIds'),
}

model ScaleQuotaResponseBody = {
  quotaId?: string(name='QuotaId', description='Quota Id', example='quotamtl37ge7gkvdz'),
  requestId?: string(name='RequestId', example='F2D0392B-D749-5C48-A98A-3FAE5C9444A6'),
}

model ScaleQuotaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ScaleQuotaResponseBody(name='body'),
}

/**
 * @summary 扩缩容Quota
 *
 * @param request ScaleQuotaRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ScaleQuotaResponse
 */
async function scaleQuotaWithOptions(QuotaId: string, request: ScaleQuotaRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ScaleQuotaResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.min)) {
    body['Min'] = request.min;
  }
  if (!Util.isUnset(request.resourceGroupIds)) {
    body['ResourceGroupIds'] = request.resourceGroupIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ScaleQuota',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/quotas/${OpenApiUtil.getEncodeParam(QuotaId)}/action/scale`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 扩缩容Quota
 *
 * @param request ScaleQuotaRequest
 * @return ScaleQuotaResponse
 */
async function scaleQuota(QuotaId: string, request: ScaleQuotaRequest): ScaleQuotaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return scaleQuotaWithOptions(QuotaId, request, headers, runtime);
}

model StopTrainingJobResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model StopTrainingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopTrainingJobResponseBody(name='body'),
}

/**
 * @summary 停止一个TrainingJob
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopTrainingJobResponse
 */
async function stopTrainingJobWithOptions(TrainingJobId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StopTrainingJobResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StopTrainingJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/stop`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 停止一个TrainingJob
 *
 * @return StopTrainingJobResponse
 */
async function stopTrainingJob(TrainingJobId: string): StopTrainingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return stopTrainingJobWithOptions(TrainingJobId, headers, runtime);
}

model UpdateAlgorithmRequest {
  algorithmDescription?: string(name='AlgorithmDescription'),
  displayName?: string(name='DisplayName', example='LLM Train'),
}

model UpdateAlgorithmResponseBody = {
  algorithmId?: string(name='AlgorithmId', example='algo-sidjc8134hv'),
  requestId?: string(name='RequestId', example='E7C42CC7-2E85-508A-84F4-923B605FD10F'),
}

model UpdateAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAlgorithmResponseBody(name='body'),
}

/**
 * @summary 更新算法
 *
 * @param request UpdateAlgorithmRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAlgorithmResponse
 */
async function updateAlgorithmWithOptions(AlgorithmId: string, request: UpdateAlgorithmRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateAlgorithmResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithmDescription)) {
    body['AlgorithmDescription'] = request.algorithmDescription;
  }
  if (!Util.isUnset(request.displayName)) {
    body['DisplayName'] = request.displayName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAlgorithm',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新算法
 *
 * @param request UpdateAlgorithmRequest
 * @return UpdateAlgorithmResponse
 */
async function updateAlgorithm(AlgorithmId: string, request: UpdateAlgorithmRequest): UpdateAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateAlgorithmWithOptions(AlgorithmId, request, headers, runtime);
}

model UpdateAlgorithmVersionRequest {
  algorithmSpec?: AlgorithmSpec(name='AlgorithmSpec'),
}

model UpdateAlgorithmVersionShrinkRequest {
  algorithmSpecShrink?: string(name='AlgorithmSpec'),
}

model UpdateAlgorithmVersionResponseBody = {
  algorithmId?: string(name='AlgorithmId', example='algo-sidjc8134hv'),
  algorithmVersion?: string(name='AlgorithmVersion', example='v0.1.0'),
}

model UpdateAlgorithmVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAlgorithmVersionResponseBody(name='body'),
}

/**
 * @summary 更新算法
 *
 * @param tmpReq UpdateAlgorithmVersionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAlgorithmVersionResponse
 */
async function updateAlgorithmVersionWithOptions(AlgorithmId: string, AlgorithmVersion: string, tmpReq: UpdateAlgorithmVersionRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateAlgorithmVersionResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateAlgorithmVersionShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.algorithmSpec)) {
    request.algorithmSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.algorithmSpec, 'AlgorithmSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithmSpecShrink)) {
    body['AlgorithmSpec'] = request.algorithmSpecShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAlgorithmVersion',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/algorithms/${OpenApiUtil.getEncodeParam(AlgorithmId)}/versions/${OpenApiUtil.getEncodeParam(AlgorithmVersion)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新算法
 *
 * @param request UpdateAlgorithmVersionRequest
 * @return UpdateAlgorithmVersionResponse
 */
async function updateAlgorithmVersion(AlgorithmId: string, AlgorithmVersion: string, request: UpdateAlgorithmVersionRequest): UpdateAlgorithmVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateAlgorithmVersionWithOptions(AlgorithmId, AlgorithmVersion, request, headers, runtime);
}

model UpdateQuotaRequest {
  description?: string(name='Description', example='this is a test quota'),
  labels?: [
    Label
  ](name='Labels'),
  queueStrategy?: string(name='QueueStrategy'),
  quotaConfig?: QuotaConfig(name='QuotaConfig', nullable=true),
  quotaName?: string(name='QuotaName'),
}

model UpdateQuotaResponseBody = {
  quotaId?: string(name='QuotaId', description='Quota Id', example='quota-20210126170216-mtl37ge7gkvdz'),
  requestId?: string(name='RequestId', example='96496E6E-00B4-5F55-80F6-1844FA9E92DC'),
}

model UpdateQuotaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateQuotaResponseBody(name='body'),
}

/**
 * @summary 更新Quota
 *
 * @param request UpdateQuotaRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateQuotaResponse
 */
async function updateQuotaWithOptions(QuotaId: string, request: UpdateQuotaRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateQuotaResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.labels)) {
    body['Labels'] = request.labels;
  }
  if (!Util.isUnset(request.queueStrategy)) {
    body['QueueStrategy'] = request.queueStrategy;
  }
  if (!Util.isUnset(request.quotaConfig)) {
    body['QuotaConfig'] = request.quotaConfig;
  }
  if (!Util.isUnset(request.quotaName)) {
    body['QuotaName'] = request.quotaName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateQuota',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/quotas/${OpenApiUtil.getEncodeParam(QuotaId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新Quota
 *
 * @param request UpdateQuotaRequest
 * @return UpdateQuotaResponse
 */
async function updateQuota(QuotaId: string, request: UpdateQuotaRequest): UpdateQuotaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateQuotaWithOptions(QuotaId, request, headers, runtime);
}

model UpdateResourceGroupRequest {
  description?: string(name='Description', example='test_new_havpn_tf'),
  name?: string(name='Name', example='prophet'),
  unbind?: boolean(name='Unbind', example='true'),
  userVpc?: UserVpc(name='UserVpc'),
}

model UpdateResourceGroupResponseBody = {
  resourceGroupID?: string(name='ResourceGroupID', example='rgf0zhfqn1d4ity2'),
  requestId?: string(name='requestId', example='FFB1D4B4-B253-540A-9B3B-AA711C48A1B7'),
}

model UpdateResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateResourceGroupResponseBody(name='body'),
}

/**
 * @summary 更新Resource Group
 *
 * @param request UpdateResourceGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateResourceGroupResponse
 */
async function updateResourceGroupWithOptions(ResourceGroupID: string, request: UpdateResourceGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateResourceGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.unbind)) {
    body['Unbind'] = request.unbind;
  }
  if (!Util.isUnset(request.userVpc)) {
    body['UserVpc'] = request.userVpc;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateResourceGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/resources/${OpenApiUtil.getEncodeParam(ResourceGroupID)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新Resource Group
 *
 * @param request UpdateResourceGroupRequest
 * @return UpdateResourceGroupResponse
 */
async function updateResourceGroup(ResourceGroupID: string, request: UpdateResourceGroupRequest): UpdateResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateResourceGroupWithOptions(ResourceGroupID, request, headers, runtime);
}

model UpdateTrainingJobLabelsRequest {
  labels?: [ 
    {
      key?: string(name='Key', example='RootModelID'),
      value?: string(name='Value', example='model-ad8cv770kl'),
    }
  ](name='Labels'),
}

model UpdateTrainingJobLabelsResponseBody = {
  requestId?: string(name='RequestId', example='F082BD0D-21E1-5F9B-81A0-AB07485B03CD'),
}

model UpdateTrainingJobLabelsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTrainingJobLabelsResponseBody(name='body'),
}

/**
 * @summary 更新一个TrainingJob的Labels
 *
 * @param request UpdateTrainingJobLabelsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateTrainingJobLabelsResponse
 */
async function updateTrainingJobLabelsWithOptions(TrainingJobId: string, request: UpdateTrainingJobLabelsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateTrainingJobLabelsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.labels)) {
    body['Labels'] = request.labels;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTrainingJobLabels',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v1/trainingjobs/${OpenApiUtil.getEncodeParam(TrainingJobId)}/labels`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新一个TrainingJob的Labels
 *
 * @param request UpdateTrainingJobLabelsRequest
 * @return UpdateTrainingJobLabelsResponse
 */
async function updateTrainingJobLabels(TrainingJobId: string, request: UpdateTrainingJobLabelsRequest): UpdateTrainingJobLabelsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateTrainingJobLabelsWithOptions(TrainingJobId, request, headers, runtime);
}

